diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-08-08 22:54:13 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-08-08 22:54:13 +0300 |
commit | 76544283ea342cc82f15afb89c7c5a12eb6bfd8f (patch) | |
tree | 450732644b4bd82c7992ea3463bc535c73a00725 /spec/factories/users.rb | |
parent | cfabe7bf38f175b28c8c0a1bec584b6b751cbba5 (diff) |
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.
Diffstat (limited to 'spec/factories/users.rb')
-rw-r--r-- | spec/factories/users.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/factories/users.rb b/spec/factories/users.rb index e60fe713bc3..0486a413fb2 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -8,6 +8,10 @@ FactoryGirl.define do confirmation_token { nil } can_create_group true + after(:stub) do |user| + user.notification_email = user.email + end + before(:create) do |user| user.ensure_rss_token end |