Files
grecia/spec/system/moderation/legislation_proposals_spec.rb
Javi Martín a5c66c7281 Use buttons instead of links to hide content
We're continuing to replace links with buttons, for the reasons
explained in commit 5311daadf.

Since we're using the admin action component, we can also simplify the
logic handling the confirmation message.

In order to avoid duplicate IDs when generating buttons to block the
same author more than once in a page, we're including the record dom_id
in the ID of the button to block an author.
2021-12-30 15:50:03 +01:00

27 lines
937 B
Ruby

require "rails_helper"
describe "Moderate legislation proposals" do
scenario "Hide" do
citizen = create(:user)
legislation_process = create(:legislation_process)
legislation_proposal = create(:legislation_proposal, legislation_process_id: legislation_process.id)
moderator = create(:moderator)
login_as(moderator.user)
visit legislation_process_proposal_path(legislation_process, legislation_proposal)
within("#legislation_proposal_#{legislation_proposal.id}") do
accept_confirm("Are you sure? Hide \"#{legislation_proposal.title}\"") { click_button "Hide" }
end
expect(page).to have_css("#legislation_proposal_#{legislation_proposal.id}.faded")
logout
login_as(citizen)
visit legislation_process_proposals_path(legislation_process)
expect(page).to have_css(".proposal-content", count: 0)
expect(page).not_to have_button "Hide"
end
end