about summary refs log tree commit diff
path: root/spec/controllers/settings
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-01-21 18:00:08 -0600
committerGitHub <noreply@github.com>2018-01-21 18:00:08 -0600
commita90d0419d97db50cca034b9d30969f3d161a69b1 (patch)
tree86c6a4182cda85171caf2f5c1553c054ed7b7e1f /spec/controllers/settings
parent81b78fac542be867eedc7a0310e29de30b382770 (diff)
parent48d79007f616ba03f663d29536927f6ab14e4b53 (diff)
Merge pull request #343 from glitch-soc/merge-upstream-20180121
Merge upstream
Diffstat (limited to 'spec/controllers/settings')
-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