Fix common actions file rubocop issues

This commit is contained in:
Bertocq
2018-02-15 23:17:10 +01:00
parent 2aca87b3ae
commit 4e34a1cf41

View File

@@ -90,7 +90,8 @@ module CommonActions
end end
visit commentable_path visit commentable_path
fill_in "comment-body-#{commentable.class.name.gsub(/::/, '_').downcase}_#{commentable.id}", with: 'Have you thought about...?' comment_field = "comment-body-#{commentable.class.name.parameterize('_')}_#{commentable.id}"
fill_in comment_field, with: 'Have you thought about...?'
click_button 'Publish comment' click_button 'Publish comment'
expect(page).to have_content 'Have you thought about...?' expect(page).to have_content 'Have you thought about...?'
@@ -133,7 +134,8 @@ module CommonActions
def error_message(resource_model = nil) def error_message(resource_model = nil)
resource_model ||= "(.*)" resource_model ||= "(.*)"
/\d errors? prevented this #{resource_model} from being saved. Please check the marked fields to know how to correct them:/ field_check_message = 'Please check the marked fields to know how to correct them:'
/\d errors? prevented this #{resource_model} from being saved. #{field_check_message}/
end end
def expect_to_be_signed_in def expect_to_be_signed_in
@@ -237,15 +239,19 @@ module CommonActions
end end
def create_successful_proposals def create_successful_proposals
[create(:proposal, title: "Winter is coming", question: "Do you speak it?", cached_votes_up: Proposal.votes_needed_for_success + 100), [create(:proposal, title: "Winter is coming", question: "Do you speak it?",
create(:proposal, title: "Fire and blood", question: "You talking to me?", cached_votes_up: Proposal.votes_needed_for_success + 1)] cached_votes_up: Proposal.votes_needed_for_success + 100),
create(:proposal, title: "Fire and blood", question: "You talking to me?",
cached_votes_up: Proposal.votes_needed_for_success + 1)]
end end
def create_archived_proposals def create_archived_proposals
months_to_archive_proposals = Setting["months_to_archive_proposals"].to_i months_to_archive_proposals = Setting["months_to_archive_proposals"].to_i
[ [
create(:proposal, title: "This is an expired proposal", created_at: months_to_archive_proposals.months.ago), create(:proposal, title: "This is an expired proposal",
create(:proposal, title: "This is an oldest expired proposal", created_at: (months_to_archive_proposals + 2).months.ago) created_at: months_to_archive_proposals.months.ago),
create(:proposal, title: "This is an oldest expired proposal",
created_at: (months_to_archive_proposals + 2).months.ago)
] ]
end end
@@ -263,8 +269,8 @@ module CommonActions
click_link "Send notification" click_link "Send notification"
end end
fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal #{proposal.title}" fill_in 'proposal_notification_title', with: "Thanks for supporting proposal: #{proposal.title}"
fill_in 'proposal_notification_body', with: "Please share it with others so we can make it happen! #{proposal.summary}" fill_in 'proposal_notification_body', with: "Please share it with others! #{proposal.summary}"
click_button "Send message" click_button "Send message"
expect(page).to have_content "Your message has been sent correctly." expect(page).to have_content "Your message has been sent correctly."