diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/admin/admin_disables_two_factor_spec.rb | 33 |
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 |