reverts options hash for optional attributes in spec helpers
This commit is contained in:
@@ -39,7 +39,7 @@ feature 'Emails' do
|
|||||||
scenario 'Do not send email about own debate comments', :js do
|
scenario 'Do not send email about own debate comments', :js do
|
||||||
user = create(:user, email_on_debate_comment: true)
|
user = create(:user, email_on_debate_comment: true)
|
||||||
debate = create(:debate, author: user)
|
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!"
|
expect { open_last_email }.to raise_error "No email has been sent!"
|
||||||
end
|
end
|
||||||
@@ -66,7 +66,7 @@ feature 'Emails' do
|
|||||||
|
|
||||||
scenario "Do not send email about own replies to own comments", :js do
|
scenario "Do not send email about own replies to own comments", :js do
|
||||||
user = create(:user, email_on_comment_reply: true)
|
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!"
|
expect { open_last_email }.to raise_error "No email has been sent!"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ module CommonActions
|
|||||||
click_button 'Send me reset password instructions'
|
click_button 'Send me reset password instructions'
|
||||||
end
|
end
|
||||||
|
|
||||||
def comment_on(debate, options = {})
|
def comment_on(debate, user = nil)
|
||||||
user = options.fetch(:user) { create(:user) }
|
user ||= create(:user)
|
||||||
|
|
||||||
login_as(user)
|
login_as(user)
|
||||||
visit debate_path(debate)
|
visit debate_path(debate)
|
||||||
@@ -56,8 +56,9 @@ module CommonActions
|
|||||||
expect(page).to have_content 'Have you thought about...?'
|
expect(page).to have_content 'Have you thought about...?'
|
||||||
end
|
end
|
||||||
|
|
||||||
def reply_to(original_user, options = {})
|
def reply_to(original_user, manuela = nil)
|
||||||
manuela = options.fetch(:user) { create(:user) }
|
manuela ||= create(:user)
|
||||||
|
|
||||||
debate = create(:debate)
|
debate = create(:debate)
|
||||||
comment = create(:comment, commentable: debate, user: original_user)
|
comment = create(:comment, commentable: debate, user: original_user)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user