diff --git a/spec/system/moderation/budget_investments_spec.rb b/spec/system/moderation/budget_investments_spec.rb index 837af3945..32eae4501 100644 --- a/spec/system/moderation/budget_investments_spec.rb +++ b/spec/system/moderation/budget_investments_spec.rb @@ -68,9 +68,13 @@ describe "Moderate budget investments" do expect(page).not_to have_css("#investment_#{investment.id}") - investment.reload + click_link "Block users" + fill_in "email or name of user", with: investment.author.email + click_button "Search" - expect(investment.author).not_to be_hidden + within "tr", text: investment.author.name do + expect(page).to have_link "Block" + end end scenario "Block the author" do @@ -78,9 +82,13 @@ describe "Moderate budget investments" do expect(page).not_to have_css("#investment_#{investment.id}") - investment.reload + click_link "Block users" + fill_in "email or name of user", with: investment.author.email + click_button "Search" - expect(investment.author).to be_hidden + within "tr", text: investment.author.name do + expect(page).to have_content "Blocked" + end end scenario "Ignore the investment", :no_js do diff --git a/spec/system/moderation/comments_spec.rb b/spec/system/moderation/comments_spec.rb index 45b814be9..d523a913d 100644 --- a/spec/system/moderation/comments_spec.rb +++ b/spec/system/moderation/comments_spec.rb @@ -87,16 +87,28 @@ describe "Moderate comments" do accept_confirm { click_button "Hide comments" } expect(page).not_to have_css("#comment_#{comment.id}") - expect(comment.reload).to be_hidden - expect(comment.user).not_to be_hidden + + click_link "Block users" + fill_in "email or name of user", with: comment.user.email + click_button "Search" + + within "tr", text: comment.user.name do + expect(page).to have_link "Block" + end end scenario "Block the user" do accept_confirm { click_button "Block authors" } expect(page).not_to have_css("#comment_#{comment.id}") - expect(comment.reload).to be_hidden - expect(comment.user).to be_hidden + + click_link "Block users" + fill_in "email or name of user", with: comment.user.email + click_button "Search" + + within "tr", text: comment.user.name do + expect(page).to have_content "Blocked" + end end scenario "Ignore the comment", :no_js do diff --git a/spec/system/moderation/debates_spec.rb b/spec/system/moderation/debates_spec.rb index 6b70be2f6..fa9dcf74d 100644 --- a/spec/system/moderation/debates_spec.rb +++ b/spec/system/moderation/debates_spec.rb @@ -60,16 +60,28 @@ describe "Moderate debates" do accept_confirm { click_button "Hide debates" } expect(page).not_to have_css("#debate_#{debate.id}") - expect(debate.reload).to be_hidden - expect(debate.author).not_to be_hidden + + click_link "Block users" + fill_in "email or name of user", with: debate.author.email + click_button "Search" + + within "tr", text: debate.author.name do + expect(page).to have_link "Block" + end end scenario "Block the author" do accept_confirm { click_button "Block authors" } expect(page).not_to have_css("#debate_#{debate.id}") - expect(debate.reload).to be_hidden - expect(debate.author).to be_hidden + + click_link "Block users" + fill_in "email or name of user", with: debate.author.email + click_button "Search" + + within "tr", text: debate.author.name do + expect(page).to have_content "Blocked" + end end scenario "Ignore the debate", :no_js do diff --git a/spec/system/moderation/proposal_notifications_spec.rb b/spec/system/moderation/proposal_notifications_spec.rb index 8bc96c04f..e0789b13a 100644 --- a/spec/system/moderation/proposal_notifications_spec.rb +++ b/spec/system/moderation/proposal_notifications_spec.rb @@ -64,8 +64,14 @@ describe "Moderate proposal notifications" do accept_confirm { click_button "Hide proposals" } expect(page).not_to have_css("#proposal_notification_#{proposal_notification.id}") - expect(proposal_notification.reload).to be_hidden - expect(proposal_notification.author).not_to be_hidden + + click_link "Block users" + fill_in "email or name of user", with: proposal_notification.author.email + click_button "Search" + + within "tr", text: proposal_notification.author.name do + expect(page).to have_link "Block" + end end scenario "Block the author" do @@ -75,8 +81,14 @@ describe "Moderate proposal notifications" do accept_confirm { click_button "Block authors" } expect(page).not_to have_css("#proposal_notification_#{proposal_notification.id}") - expect(proposal_notification.reload).to be_hidden - expect(author.reload).to be_hidden + + click_link "Block users" + fill_in "email or name of user", with: proposal_notification.author.email + click_button "Search" + + within "tr", text: proposal_notification.author.name do + expect(page).to have_content "Blocked" + end end scenario "Ignore the proposal", :no_js do diff --git a/spec/system/moderation/proposals_spec.rb b/spec/system/moderation/proposals_spec.rb index 5cf847c7e..cfc37d07a 100644 --- a/spec/system/moderation/proposals_spec.rb +++ b/spec/system/moderation/proposals_spec.rb @@ -59,16 +59,28 @@ describe "Moderate proposals" do accept_confirm { click_button "Hide proposals" } expect(page).not_to have_css("#proposal_#{proposal.id}") - expect(proposal.reload).to be_hidden - expect(proposal.author).not_to be_hidden + + click_link "Block users" + fill_in "email or name of user", with: proposal.author.email + click_button "Search" + + within "tr", text: proposal.author.name do + expect(page).to have_link "Block" + end end scenario "Block the author" do accept_confirm { click_button "Block authors" } expect(page).not_to have_css("#proposal_#{proposal.id}") - expect(proposal.reload).to be_hidden - expect(proposal.author).to be_hidden + + click_link "Block users" + fill_in "email or name of user", with: proposal.author.email + click_button "Search" + + within "tr", text: proposal.author.name do + expect(page).to have_content "Blocked" + end end scenario "Ignore the proposal", :no_js do