This version fixes false negatives for Lint/SymbolConversion when using string interpolation, for Style/RedundantArgument when using the safe navigation operator, for Style/RedundantParentheses when logical operators are involved and for Style/RedundantReturn with lambda ending with return. We're applying the new rules. Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.56.4 to 1.61.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.56.4...v1.61.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
69 lines
2.0 KiB
Ruby
69 lines
2.0 KiB
Ruby
module Notifications
|
|
def click_notifications_icon
|
|
find("#notifications a").click
|
|
end
|
|
|
|
def model_name(described_class)
|
|
return :proposal_notification if described_class == ProposalNotification
|
|
|
|
described_class.name.gsub("::", "_").downcase.to_sym
|
|
end
|
|
|
|
def comment_body(resource)
|
|
if resource.class.name == "Legislation::Question"
|
|
"Leave your answer"
|
|
else
|
|
"Leave your comment"
|
|
end
|
|
end
|
|
|
|
def submit_comment_text(resource)
|
|
if resource.class.name == "Legislation::Question"
|
|
"Publish answer"
|
|
else
|
|
"Publish comment"
|
|
end
|
|
end
|
|
|
|
def create_proposal_notification(proposal)
|
|
login_as(proposal.author)
|
|
visit root_path
|
|
|
|
click_link "My content"
|
|
|
|
within("#proposal_#{proposal.id}") do
|
|
click_link "Dashboard"
|
|
end
|
|
|
|
within("#side_menu") do
|
|
click_link "Message to users"
|
|
end
|
|
|
|
click_link "Send notification to proposal followers"
|
|
|
|
fill_in "proposal_notification_title", with: "Thanks for supporting proposal: #{proposal.title}"
|
|
fill_in "proposal_notification_body", with: "Please share it with others! #{proposal.summary}"
|
|
click_button "Send notification"
|
|
|
|
expect(page).to have_content "Your message has been sent correctly."
|
|
Notification.last
|
|
end
|
|
|
|
def path_for(resource)
|
|
polymorphic_path(resource)
|
|
end
|
|
|
|
def error_message(resource_model = nil)
|
|
resource_model ||= "(.*)"
|
|
field_check_message = "Please check the marked fields to know how to correct them:"
|
|
/\d errors? prevented this #{resource_model} from being saved.(\n| )#{field_check_message}/
|
|
end
|
|
|
|
def fill_in_admin_notification_form(options = {})
|
|
select (options[:segment_recipient] || "All users"), from: :admin_notification_segment_recipient
|
|
fill_in "Title", with: options[:title] || "This is the notification title"
|
|
fill_in "Text", with: options[:body] || "This is the notification body"
|
|
fill_in :admin_notification_link, with: options[:link] || "https://www.decide.madrid.es/vota"
|
|
end
|
|
end
|