summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-07-10 17:11:39 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-07-10 17:18:33 -0400
commitdb8f4c06060d002c63b20ff51871976aaf9c9d4c (patch)
tree611a3d6c776334338b1cba61ce693acbd82691dd /spec
parent800df45db2dd9f3baf8377896ecde8a917901fe6 (diff)
downloadgitlab-ce-db8f4c06060d002c63b20ff51871976aaf9c9d4c.tar.gz
Add a button to Admin::Users#show to disable 2FA for that userrs-disable-2fa-by-admin
Diffstat (limited to 'spec')
-rw-r--r--spec/features/admin/admin_disables_two_factor_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/features/admin/admin_disables_two_factor_spec.rb b/spec/features/admin/admin_disables_two_factor_spec.rb
new file mode 100644
index 00000000000..71be66303d2
--- /dev/null
+++ b/spec/features/admin/admin_disables_two_factor_spec.rb
@@ -0,0 +1,33 @@
+require 'rails_helper'
+
+feature 'Admin disables 2FA for a user', feature: true do
+ scenario 'successfully', js: true do
+ login_as(:admin)
+ user = create(:user, :two_factor)
+
+ edit_user(user)
+ page.within('.two-factor-status') do
+ click_link 'Disable'
+ end
+
+ page.within('.two-factor-status') do
+ expect(page).to have_content 'Disabled'
+ expect(page).not_to have_button 'Disable'
+ end
+ end
+
+ scenario 'for a user without 2FA enabled' do
+ login_as(:admin)
+ user = create(:user)
+
+ edit_user(user)
+
+ page.within('.two-factor-status') do
+ expect(page).not_to have_button 'Disable'
+ end
+ end
+
+ def edit_user(user)
+ visit admin_user_path(user)
+ end
+end