Test restoring data from the user's point of view

We were checking the database, but users don't care about what's inside
the database; they care about what happens when they visit the page of a
record they've just restored.

This way we also avoid data inconsistency due to the process running the
test accessing the database after the process running the browser has
started.
This commit is contained in:
Javi Martín
2021-04-10 15:10:50 +02:00
parent fcb5f71ff2
commit a586ba8069
6 changed files with 19 additions and 12 deletions

View File

@@ -22,9 +22,9 @@ describe "Admin hidden budget investments", :admin do
expect(page).not_to have_content(investment.title) expect(page).not_to have_content(investment.title)
investment.reload visit budget_investment_path(investment.budget, investment)
expect(investment).to be_ignored_flag expect(page).to have_content(investment.title)
end end
scenario "Confirm hide" do scenario "Confirm hide" do

View File

@@ -71,8 +71,9 @@ describe "Admin hidden comments", :admin do
expect(page).not_to have_content(comment.body) expect(page).not_to have_content(comment.body)
expect(comment.reload).not_to be_hidden visit comment_path(comment)
expect(comment).to be_ignored_flag
expect(page).to have_content(comment.body)
end end
scenario "Confirm hide" do scenario "Confirm hide" do

View File

@@ -9,8 +9,9 @@ describe "Admin hidden debates", :admin do
expect(page).not_to have_content(debate.title) expect(page).not_to have_content(debate.title)
expect(debate.reload).not_to be_hidden visit debate_path(debate)
expect(debate).to be_ignored_flag
expect(page).to have_content debate.title
end end
scenario "Confirm hide" do scenario "Confirm hide" do

View File

@@ -22,8 +22,9 @@ describe "Admin hidden proposals", :admin do
expect(page).not_to have_content(proposal.title) expect(page).not_to have_content(proposal.title)
expect(proposal.reload).not_to be_hidden visit proposal_path(proposal)
expect(proposal).to be_ignored_flag
expect(page).to have_content proposal.title
end end
scenario "Confirm hide" do scenario "Confirm hide" do

View File

@@ -25,7 +25,9 @@ describe "Admin hidden users", :admin do
expect(page).not_to have_content(user.username) expect(page).not_to have_content(user.username)
expect(user.reload).not_to be_hidden visit user_path(user)
expect(page).to have_content(user.username)
end end
scenario "Confirm hide" do scenario "Confirm hide" do

View File

@@ -17,9 +17,11 @@ describe "Admin proposal notifications", :admin do
expect(page).not_to have_content(proposal_notification.title) expect(page).not_to have_content(proposal_notification.title)
expect(proposal_notification.reload).not_to be_hidden logout
expect(proposal_notification).to be_ignored login_as(proposal_notification.author)
expect(proposal_notification).not_to be_moderated visit proposal_notification_path(proposal_notification)
expect(page).to have_content(proposal_notification.title)
end end
scenario "Confirm hide" do scenario "Confirm hide" do