summaryrefslogtreecommitdiff
path: root/spec/controllers/admin
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-07-10 17:11:18 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-07-10 17:18:17 -0400
commit800df45db2dd9f3baf8377896ecde8a917901fe6 (patch)
treec6da56aa6b6e3597f00cded3e095817b6a753c42 /spec/controllers/admin
parent22724418d350001e2683b68fad65186af783d3f2 (diff)
downloadgitlab-ce-800df45db2dd9f3baf8377896ecde8a917901fe6.tar.gz
Add disable_two_factor route for Admin::Users
Diffstat (limited to 'spec/controllers/admin')
-rw-r--r--spec/controllers/admin/users_controller_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb
index 550a91a79e2..6f4c8987637 100644
--- a/spec/controllers/admin/users_controller_spec.rb
+++ b/spec/controllers/admin/users_controller_spec.rb
@@ -36,4 +36,32 @@ describe Admin::UsersController do
expect(user.access_locked?).to be_falsey
end
end
+
+ describe 'PATCH disable_two_factor' do
+ let(:user) { create(:user) }
+
+ it 'disables 2FA for the user' do
+ expect(user).to receive(:disable_two_factor!)
+ allow(subject).to receive(:user).and_return(user)
+
+ go
+ end
+
+ it 'redirects back' do
+ go
+
+ expect(response).to redirect_to(admin_user_path(user))
+ end
+
+ it 'displays an alert' do
+ go
+
+ expect(flash[:notice]).
+ to eq 'Two-factor Authentication has been disabled for this user'
+ end
+
+ def go
+ patch :disable_two_factor, id: user.to_param
+ end
+ end
end