Test the user's point of view in moderation specs
We were checking what happens in the database, but what's important is what users experience after hiding content or blocking authors. Besides, accessing the database in tests after the browser has started might lead to database inconsistencies.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user