From 1e94af0eb4dd68a440c29908f5f503ae1ccaf285 Mon Sep 17 00:00:00 2001 From: Laney Stroup Date: Sat, 18 May 2024 14:50:03 +0900 Subject: [PATCH] update EnableOtpForm tests to reload user before checking whether OTP was enabled, and to check for actual page content rather than flash message content for reliability; --- test/integration/enable_otp_form_test.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/test/integration/enable_otp_form_test.rb b/test/integration/enable_otp_form_test.rb index 6c042f2..e2df6ae 100644 --- a/test/integration/enable_otp_form_test.rb +++ b/test/integration/enable_otp_form_test.rb @@ -18,9 +18,8 @@ def teardown assert_equal user_otp_token_path, current_path assert page.has_content?("Enabled") - assert user.otp_auth_secret.enabled? - assert !user.otp_auth_secret.nil? - assert !user.otp_persistence_seed.nil? + user.reload + assert user.otp_enabled? end test "a user should not be able enable their OTP authentication with an incorrect confirmation code" do @@ -32,9 +31,10 @@ def teardown click_button "Continue..." - assert page.has_content?("did not match") + assert page.has_content?("To Enable Two-Factor Authentication") - assert !user.otp_auth_secret.enabled? + user.reload + assert_not user.otp_enabled? end test "a user should not be able enable their OTP authentication with a blank confirmation code" do @@ -46,9 +46,10 @@ def teardown click_button "Continue..." - assert page.has_content?("did not match") + assert page.has_content?("To Enable Two-Factor Authentication") - assert !user.otp_auth_secret.enabled? + user.reload + assert_not user.otp_enabled? end end