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)
investment.reload
visit budget_investment_path(investment.budget, investment)
expect(investment).to be_ignored_flag
expect(page).to have_content(investment.title)
end
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(comment.reload).not_to be_hidden
expect(comment).to be_ignored_flag
visit comment_path(comment)
expect(page).to have_content(comment.body)
end
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(debate.reload).not_to be_hidden
expect(debate).to be_ignored_flag
visit debate_path(debate)
expect(page).to have_content debate.title
end
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(proposal.reload).not_to be_hidden
expect(proposal).to be_ignored_flag
visit proposal_path(proposal)
expect(page).to have_content proposal.title
end
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(user.reload).not_to be_hidden
visit user_path(user)
expect(page).to have_content(user.username)
end
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(proposal_notification.reload).not_to be_hidden
expect(proposal_notification).to be_ignored
expect(proposal_notification).not_to be_moderated
logout
login_as(proposal_notification.author)
visit proposal_notification_path(proposal_notification)
expect(page).to have_content(proposal_notification.title)
end
scenario "Confirm hide" do