Add an extra visit to avoid checking the same content

We were checking that, after a `visit`, we're redirected to the account
page, but, since we were already in the account page, the page doesn't
change at all. In order to be 100% that the request caused by the call
to `visit` has finished before checking the expectations, we're visiting
a different page first.
This commit is contained in:
Javi Martín
2025-03-12 13:46:14 +01:00
parent 98fec3bb2f
commit 2c05d7fbe7

View File

@@ -76,6 +76,10 @@ describe "SMS Verification" do
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later." expect(page).to have_content "You have reached the maximum number of attempts. Please try again later."
expect(page).to have_current_path(account_path) expect(page).to have_current_path(account_path)
visit root_path
expect(page).not_to have_content "You have reached the maximum number of attempts"
visit new_sms_path visit new_sms_path
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later." expect(page).to have_content "You have reached the maximum number of attempts. Please try again later."
expect(page).to have_current_path(account_path) expect(page).to have_current_path(account_path)