reverts options hash for optional attributes in spec helpers

This commit is contained in:
David Gil
2015-09-10 18:55:03 +02:00
parent 3f652262e7
commit 3386a29eb4
2 changed files with 7 additions and 6 deletions

View File

@@ -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

View File

@@ -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)