BigW Consortium Gitlab

Commit 76544283 by Robert Speicher

Manually assign `notification_email` in the User factory when stubbed

Because we assign this value in the model via a callback conditionally on `email_changed?`, this never gets set when using `build_stubbed`, resulting in a "can't be blank" validation error on this field. In this case, we can just assign it manually to the same value as `email`, which is generated via a sequence.
parent cfabe7bf
...@@ -8,6 +8,10 @@ FactoryGirl.define do ...@@ -8,6 +8,10 @@ FactoryGirl.define do
confirmation_token { nil } confirmation_token { nil }
can_create_group true can_create_group true
after(:stub) do |user|
user.notification_email = user.email
end
before(:create) do |user| before(:create) do |user|
user.ensure_rss_token user.ensure_rss_token
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment