Query the database before a visit in campaigns test

This test was failing sometimes. One possible cause (although it might
not be the only one) is we were querying the database with
`Campaing.last` after starting the process running the browser with a
`visit`. In the past doing so has resulted in database inconsistencies
while running the tests.

Since after running the test more than 1500 times we weren't able to
reproduce the failure, it's possible that this change doesn't fix the
issue which caused the test to fail, but in the worst case scenario we
reduce the number of possible reasons why it fails.
This commit is contained in:
Javi Martín
2021-11-18 14:58:44 +01:00
parent f64377ad5a
commit 006128da57

View File

@@ -20,8 +20,10 @@ describe "Email campaigns", :admin do
end
scenario "Do not track erroneous track_ids" do
invalid_id = Campaign.last.id + 1
visit root_path(track_id: campaign1.track_id)
visit root_path(track_id: Campaign.last.id + 1)
visit root_path(track_id: invalid_id)
visit admin_stats_path