spec/factories/factories.rb in symphonia-2.2.1 vs spec/factories/factories.rb in symphonia-3.0.0
- old
+ new
@@ -4,11 +4,11 @@
sequence(:last_name) { |n| "#{Faker::Name.last_name} #{n}" }
sequence(:email) { |n| "#{n}" + Faker::Internet.email }
login { email }
admin { false }
password { SecureRandom.hex(16) }
- password_confirmation { password }
+ # password_confirmation { password }
last_request_at { Time.now }
trait :admin do
admin { true }
end
@@ -16,10 +16,10 @@
trait :with_preferences do
transient do
preference_names { [] }
end
after(:build) do |user, evaluator|
- user.preferences = evaluator.preference_names.collect { |pref_name| FactoryBot.create(:email_preference, name: pref_name) }
+ user.preferences = evaluator.preference_names.collect { |pref_name| Symphonia::EmailPreference.find_by(name: pref_name) || FactoryBot.create(:email_preference, name: pref_name) }
end
end
factory :admin_user, traits: [:admin]
end