我在使用ruby 2.5.5版本的factorybot 规范失败,并出现以下错误
Failure/Error: @user = FactoryBot.create(:user)
NoMethodError:
undefined method `password=' for #<User:0x000055dcec0bc628>
# /bundle/gems/carrierwave-crop-0.1.2/lib/carrierwave/crop/model_additions.rb:42:in `method_missing'
//工厂漫游器代码
FactoryBot.define do
factory :user, aliases: [:author] do
fullname { 'user1' }
email { "user#{rand(999)}@gmail.com" }
password { 'passwordis12345' }
end
end
答案 0 :(得分:0)
这是因为缺少attr_accessor