Make moderation tests easier to read

This commit is contained in:
Javi Martín
2023-07-18 23:26:38 +02:00
parent 316db607fe
commit 07e1f92dd5
4 changed files with 9 additions and 8 deletions

View File

@@ -212,12 +212,12 @@ describe "Admin activity" do
context "User" do
scenario "Shows moderation activity on users" do
proposal = create(:proposal)
proposal = create(:proposal, author: create(:user, username: "Sam"))
visit proposal_path(proposal)
within("#proposal_#{proposal.id}") do
accept_confirm("Are you sure? This will hide the user \"#{proposal.author.name}\" and all their contents.") do
accept_confirm("Are you sure? This will hide the user \"Sam\" and all their contents.") do
click_button "Block author"
end

View File

@@ -2,7 +2,7 @@ require "rails_helper"
describe "Admin hidden comments", :admin do
scenario "Do not show comments from blocked users" do
comment = create(:comment, :hidden, body: "SPAM from SPAMMER")
comment = create(:comment, :hidden, body: "SPAM from SPAMMER", author: create(:user, username: "Evil"))
proposal = create(:proposal, author: comment.author)
create(:comment, commentable: proposal, user: comment.author, body: "Good Proposal!")
@@ -13,7 +13,7 @@ describe "Admin hidden comments", :admin do
visit proposal_path(proposal)
within("#proposal_#{proposal.id}") do
accept_confirm("Are you sure? This will hide the user \"#{proposal.author.name}\" and all their contents.") do
accept_confirm("Are you sure? This will hide the user \"Evil\" and all their contents.") do
click_button "Block author"
end
end

View File

@@ -4,7 +4,8 @@ describe "Moderate budget investments" do
let(:budget) { create(:budget) }
let(:heading) { create(:budget_heading, budget: budget, price: 666666) }
let(:mod) { create(:moderator) }
let!(:investment) { create(:budget_investment, heading: heading, author: create(:user)) }
let(:author) { create(:user, username: "Julia") }
let!(:investment) { create(:budget_investment, heading: heading, author: author) }
scenario "Hiding an investment" do
login_as(mod.user)
@@ -23,7 +24,7 @@ describe "Moderate budget investments" do
login_as(mod.user)
visit budget_investment_path(budget, investment)
accept_confirm("Are you sure? This will hide the user \"#{investment.author.name}\" and all their contents.") do
accept_confirm("Are you sure? This will hide the user \"Julia\" and all their contents.") do
click_button "Block author"
end

View File

@@ -2,7 +2,7 @@ require "rails_helper"
describe "Moderate users" do
scenario "Hide" do
citizen = create(:user)
citizen = create(:user, username: "Mike")
moderator = create(:moderator)
debate1 = create(:debate, author: citizen)
@@ -24,7 +24,7 @@ describe "Moderate users" do
visit debate_path(debate1)
within("#debate_#{debate1.id}") do
accept_confirm("Are you sure? This will hide the user \"#{debate1.author.name}\" and all their contents.") do
accept_confirm("Are you sure? This will hide the user \"Mike\" and all their contents.") do
click_button "Block author"
end
end