about summary refs log tree commit diff
path: root/spec/controllers
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-01-21 13:36:10 -0600
committerDavid Yip <yipdw@member.fsf.org>2018-01-21 13:36:10 -0600
commit1253279febc05c96e4ec875588a0c1c6d723b23c (patch)
treebd4adcddd508239656ff8d37f636af800aa0f742 /spec/controllers
parent2c578a01d86ef65d1b0117f6fff32a6b57463dde (diff)
parentcfd2b06821a12f6b4aae427dbb9e6707d1cff9dc (diff)
Merge remote-tracking branch 'origin/master' into merge-upstream
 Conflicts:
	app/controllers/settings/two_factor_authentication/confirmations_controller.rb
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb b/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb
index 0676d6161..aee82a3d8 100644
--- a/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb
+++ b/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb
@@ -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