Convert settings/two_factor_authentication_methods
spec controller->system/request (#33914)
This commit is contained in:
parent
62dc303d3c
commit
8f1b41622b
3 changed files with 76 additions and 79 deletions
|
@ -0,0 +1,35 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Settings TwoFactorAuthenticationMethods' do
|
||||
context 'when not signed in' do
|
||||
describe 'GET to /settings/two_factor_authentication_methods' do
|
||||
it 'redirects to sign in page' do
|
||||
get settings_two_factor_authentication_methods_path
|
||||
|
||||
expect(response)
|
||||
.to redirect_to(new_user_session_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when signed in' do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
before { sign_in user }
|
||||
|
||||
describe 'GET to /settings/two_factor_authentication_methods' do
|
||||
describe 'when user has not enabled otp' do
|
||||
before { user.update(otp_required_for_login: false) }
|
||||
|
||||
it 'redirects to enable otp' do
|
||||
get settings_two_factor_authentication_methods_path
|
||||
|
||||
expect(response)
|
||||
.to redirect_to(settings_otp_authentication_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue