Skip to content

Commit

Permalink
update EnableOtpForm tests to reload user before checking whether OTP…
Browse files Browse the repository at this point in the history
… was enabled, and to check for actual page content rather than flash message content for reliability;
  • Loading branch information
strouptl committed May 18, 2024
1 parent 074b67e commit 1e94af0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/integration/enable_otp_form_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit 1e94af0

Please sign in to comment.