Skip to content

Commit 1bd0c37

Browse files
committed
added controller test for the app 2FA happy path
1 parent 2a6f8a8 commit 1bd0c37

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/controllers/users/sessions_controller_test.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ class Users::SessionsControllerTest < ActionController::TestCase
2828
assert @controller.remember_me_is_active?(current_user)
2929
end
3030

31+
test 'should redirect users with code-based 2FA to code verification' do
32+
pass = 'temp password for testing manual 2FA signin'
33+
user = users(:enabled_2fa)
34+
user.update!(password: pass)
35+
36+
post :create, params: { user: { email: user.email, password: pass } }
37+
38+
assert_response(:found)
39+
assert_nil flash[:notice]
40+
assert_redirected_to(login_verify_2fa_path(uid: user.id, remember_me: false))
41+
end
42+
3143
private
3244

3345
def set_mapping

0 commit comments

Comments
 (0)