|
|
@ -6,6 +6,7 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do |
|
|
|
render_views |
|
|
|
render_views |
|
|
|
|
|
|
|
|
|
|
|
let(:user) { Fabricate(:user, email: 'local-part@domain', otp_secret: 'thisisasecretforthespecofnewview') } |
|
|
|
let(:user) { Fabricate(:user, email: 'local-part@domain', otp_secret: 'thisisasecretforthespecofnewview') } |
|
|
|
|
|
|
|
let(:user_without_otp_secret) { Fabricate(:user, email: 'local-part@domain') } |
|
|
|
|
|
|
|
|
|
|
|
shared_examples 'renders :new' do |
|
|
|
shared_examples 'renders :new' do |
|
|
|
it 'renders the new view' do |
|
|
|
it 'renders the new view' do |
|
|
@ -33,6 +34,12 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do |
|
|
|
get :new |
|
|
|
get :new |
|
|
|
expect(response).to redirect_to('/auth/sign_in') |
|
|
|
expect(response).to redirect_to('/auth/sign_in') |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'redirects if user do not have otp_secret' do |
|
|
|
|
|
|
|
sign_in user_without_otp_secret, scope: :user |
|
|
|
|
|
|
|
get :new |
|
|
|
|
|
|
|
expect(response).to redirect_to('/settings/two_factor_authentication') |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe 'POST #create' do |
|
|
|
describe 'POST #create' do |
|
|
|