diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index cd4d85116..b6a9d1db5 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -39,7 +39,7 @@ feature 'Emails' do scenario 'Do not send email about own debate comments', :js do user = create(:user, email_on_debate_comment: true) debate = create(:debate, author: user) - comment_on(debate, user: user) + comment_on(debate, user) expect { open_last_email }.to raise_error "No email has been sent!" end @@ -66,7 +66,7 @@ feature 'Emails' do scenario "Do not send email about own replies to own comments", :js do user = create(:user, email_on_comment_reply: true) - reply_to(user, user: user) + reply_to(user, user) expect { open_last_email }.to raise_error "No email has been sent!" end diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index d7f2106a7..508daa297 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -44,8 +44,8 @@ module CommonActions click_button 'Send me reset password instructions' end - def comment_on(debate, options = {}) - user = options.fetch(:user) { create(:user) } + def comment_on(debate, user = nil) + user ||= create(:user) login_as(user) visit debate_path(debate) @@ -56,8 +56,9 @@ module CommonActions expect(page).to have_content 'Have you thought about...?' end - def reply_to(original_user, options = {}) - manuela = options.fetch(:user) { create(:user) } + def reply_to(original_user, manuela = nil) + manuela ||= create(:user) + debate = create(:debate) comment = create(:comment, commentable: debate, user: original_user)