diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-07-13 11:49:46 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-07-13 11:49:46 +0300 |
commit | 171d6fccae79efe4e85e772cb501b2e23e862b19 (patch) | |
tree | e29d388953560ad60386b96adbac83c47fa3f033 /spec/controllers | |
parent | d93da8bed598249c67b71b3acdd4944952e80db2 (diff) | |
parent | db8f4c06060d002c63b20ff51871976aaf9c9d4c (diff) |
Merge branch 'rs-disable-2fa-by-admin' into 'master'
Allow admins to disable 2FA for a user
> ![Screen_Shot_2015-07-10_at_5.19.13_PM](https://gitlab.com/gitlab-org/gitlab-ce/uploads/3f9bb7c783110d2689c282879cb4b061/Screen_Shot_2015-07-10_at_5.19.13_PM.png)
Depends on !961
See merge request !962
Diffstat (limited to 'spec/controllers')
-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 |