From 2c05d7fbe74d210e577a141991332b42019e3f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 12 Mar 2025 13:46:14 +0100 Subject: [PATCH] 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. --- spec/system/verification/sms_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/system/verification/sms_spec.rb b/spec/system/verification/sms_spec.rb index 707abc6e3..13b232f05 100644 --- a/spec/system/verification/sms_spec.rb +++ b/spec/system/verification/sms_spec.rb @@ -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_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 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)