Added test to ensure email is sent to users with email_always set even if the notification has been read

This commit is contained in:
Peter N Lewis 2014-06-09 19:09:36 +08:00
parent d0ebdea5fa
commit 87e254cc3a
1 changed files with 8 additions and 0 deletions

View File

@ -124,6 +124,14 @@ describe Jobs::UserEmail do
Jobs::UserEmail.new.execute(type: :user_mentioned, user_id: user.id, notification_id: notification.id)
end
it "do send the email if the notification has been seen but the user is set for email_always" do
Email::Sender.any_instance.expects(:send)
notification.update_column(:read, true)
user.update_column(:email_always, true)
Jobs::UserEmail.new.execute(type: :user_mentioned, user_id: user.id, notification_id: notification.id)
user.update_column(:email_always, false)
end
it "doesn't send the email if the post has been user deleted" do
Email::Sender.any_instance.expects(:send).never
post.update_column(:user_deleted, true)