diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-07-10 17:11:18 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-07-10 17:18:17 -0400 |
commit | 800df45db2dd9f3baf8377896ecde8a917901fe6 (patch) | |
tree | c6da56aa6b6e3597f00cded3e095817b6a753c42 /spec/controllers/admin | |
parent | 22724418d350001e2683b68fad65186af783d3f2 (diff) | |
download | gitlab-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.rb | 28 |
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 |