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:
parent
d0ebdea5fa
commit
87e254cc3a
|
@ -124,6 +124,14 @@ describe Jobs::UserEmail do
|
||||||
Jobs::UserEmail.new.execute(type: :user_mentioned, user_id: user.id, notification_id: notification.id)
|
Jobs::UserEmail.new.execute(type: :user_mentioned, user_id: user.id, notification_id: notification.id)
|
||||||
end
|
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
|
it "doesn't send the email if the post has been user deleted" do
|
||||||
Email::Sender.any_instance.expects(:send).never
|
Email::Sender.any_instance.expects(:send).never
|
||||||
post.update_column(:user_deleted, true)
|
post.update_column(:user_deleted, true)
|
||||||
|
|
Loading…
Reference in New Issue