Check page content in ballots specs

Even after disabling the turbolinks previews in the previous commit
(which is still necessary, even with the changes in this commit), these
tests were still finishing before the "Go back" requests did. To
reproduce an issue caused by this behavior, run:

```
rspec spec/system/budgets/ballots_spec.rb:425 spec/system/users_auth_spec.rb:701 --seed 40358
```

Apparently, a `have_current_path` expectation isn't enough to check that
the request has finished and it only checks that the request to that
path has started or it's being processed.

Adding an additional expectation to check that the content of the page
has changed solves the issue.
This commit is contained in:
Javi Martín
2024-10-15 12:13:53 +02:00
parent b870e29170
commit 27a4dc1471

View File

@@ -444,6 +444,7 @@ describe "Ballots" do
click_link "Go back" click_link "Go back"
expect(page).to have_current_path(budget_investments_path(budget, heading_id: new_york.id)) expect(page).to have_current_path(budget_investments_path(budget, heading_id: new_york.id))
expect(page).to have_link "Check my votes"
end end
scenario "before adding any investments" do scenario "before adding any investments" do
@@ -459,6 +460,7 @@ describe "Ballots" do
click_link "Go back" click_link "Go back"
expect(page).to have_current_path(budget_investments_path(budget, heading_id: new_york.id)) expect(page).to have_current_path(budget_investments_path(budget, heading_id: new_york.id))
expect(page).to have_link "Check my votes"
end end
end end