debian-mirror-gitlab/spec/features/admin/admin_disables_two_factor_spec.rb

36 lines
743 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2019-12-04 20:38:33 +05:30
require 'spec_helper'
2015-09-11 14:41:01 +05:30
2018-11-08 19:23:39 +05:30
describe 'Admin disables 2FA for a user' do
it 'successfully', :js do
2017-09-10 17:25:29 +05:30
sign_in(create(:admin))
2015-09-11 14:41:01 +05:30
user = create(:user, :two_factor)
edit_user(user)
page.within('.two-factor-status') do
2018-03-17 18:26:18 +05:30
accept_confirm { click_link 'Disable' }
2015-09-11 14:41:01 +05:30
end
page.within('.two-factor-status') do
expect(page).to have_content 'Disabled'
expect(page).not_to have_button 'Disable'
end
end
2018-11-08 19:23:39 +05:30
it 'for a user without 2FA enabled' do
2017-09-10 17:25:29 +05:30
sign_in(create(:admin))
2015-09-11 14:41:01 +05:30
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