summaryrefslogtreecommitdiff
path: root/spec/features/admin/admin_users_spec.rb
diff options
context:
space:
mode:
authorPavel Forkert <fxposter@gmail.com>2015-09-24 16:34:04 +0300
committerPavel Forkert <fxposter@gmail.com>2015-09-24 16:34:04 +0300
commiteb9528b8b964c78ef3d33818286c529b83c35a5e (patch)
tree9cec858861f8ff8c3099e6d6ef00d2b5409f597a /spec/features/admin/admin_users_spec.rb
parent83347954fc3c0c317c77f0528cdbaa456093771a (diff)
downloadgitlab-ce-eb9528b8b964c78ef3d33818286c529b83c35a5e.tar.gz
Move login button to user page, switched to POST method
Diffstat (limited to 'spec/features/admin/admin_users_spec.rb')
-rw-r--r--spec/features/admin/admin_users_spec.rb37
1 files changed, 21 insertions, 16 deletions
diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb
index 870a82d0ee0..67da3c199ad 100644
--- a/spec/features/admin/admin_users_spec.rb
+++ b/spec/features/admin/admin_users_spec.rb
@@ -111,6 +111,27 @@ describe "Admin::Users", feature: true do
expect(page).to have_content(@user.name)
end
+ describe 'Login as another user' do
+ it 'should show login button for other users' do
+ another_user = create(:user)
+
+ visit admin_user_path(another_user)
+
+ click_link 'Log in as this user'
+
+ expect(page).to have_content("Logged in as #{another_user.username}")
+
+ page.within '.sidebar-user .username' do
+ expect(page).to have_content(another_user.username)
+ end
+ end
+
+ it 'should not show login button for admin itself' do
+ visit admin_user_path(@user)
+ expect(page).not_to have_content('Log in as this user')
+ end
+ end
+
describe 'Two-factor Authentication status' do
it 'shows when enabled' do
@user.update_attribute(:two_factor_enabled, true)
@@ -166,20 +187,4 @@ describe "Admin::Users", feature: true do
end
end
end
-
- it 'should be able to log in as another user' do
- another_user = create(:user)
-
- visit admin_users_path
-
- page.within ".user-#{another_user.id}" do
- click_link 'Log in'
- end
-
- expect(page).to have_content("Logged in as #{another_user.username}")
-
- page.within '.sidebar-user .username' do
- expect(page).to have_content(another_user.username)
- end
- end
end