Merge remote-tracking branch 'origin/master' into merge-upstream

Conflicts:
	app/controllers/settings/two_factor_authentication/confirmations_controller.rb
This commit is contained in:
David Yip
2018-01-21 13:36:10 -06:00
9 changed files with 67 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do
render_views
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
it 'renders the new view' do
@@ -33,6 +34,12 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do
get :new
expect(response).to redirect_to('/auth/sign_in')
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
describe 'POST #create' do