From 80f97b3ca6bad691d7e50b5f5a5273f30bca6a42 Mon Sep 17 00:00:00 2001 From: iagirre Date: Thu, 8 Feb 2018 08:21:59 +0100 Subject: [PATCH] The flaky test has been modified completely to test the functionality described. JS has been avoided because it was one of the problems involved and it wasn't completely necessary. --- spec/features/emails_spec.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index 02892ef18..dd19f2a0b 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -492,11 +492,15 @@ feature 'Emails' do end context "Users without email" do - scenario "should not receive emails", :js do + scenario "should not receive emails" do user = create(:user, :verified, email_on_comment: true) proposal = create(:proposal, author: user) + + user_commenting = create(:user) + comment = create(:comment, commentable: proposal, user: user_commenting) user.update(email: nil) - comment_on(proposal) + + Mailer.comment(comment).deliver_now expect { open_last_email }.to raise_error "No email has been sent!" end