summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnnabel Dunstone <annabel.dunstone@gmail.com>2016-06-02 17:31:26 -0600
committerAnnabel Dunstone <annabel.dunstone@gmail.com>2016-06-07 09:16:59 -0500
commitffbd9cd02d701442b5304e84ad75d657eeb4e23f (patch)
treedd14574c429ecd115f3001aeb84604d151f1e4db
parent7c501895a33e2771097e14ddf7171164ccc27d01 (diff)
downloadgitlab-ce-ffbd9cd02d701442b5304e84ad75d657eeb4e23f.tar.gz
Test impersonation using img data attribute instead of username
-rw-r--r--app/views/layouts/_page.html.haml2
-rw-r--r--spec/features/admin/admin_users_spec.rb8
2 files changed, 5 insertions, 5 deletions
diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml
index f0ba62fa68d..261038ef940 100644
--- a/app/views/layouts/_page.html.haml
+++ b/app/views/layouts/_page.html.haml
@@ -15,7 +15,7 @@
.collapse-nav
= render partial: 'layouts/collapse_button'
- if current_user
- = link_to current_user, class: 'sidebar-user', title: "Profile" do
+ = link_to current_user, class: 'sidebar-user', title: "Profile", data: {user: current_user.username} do
= image_tag avatar_icon(current_user, 60), alt: 'Profile', class: 'avatar avatar s46'
- if defined?(nav) && nav
.layout-nav
diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb
index b72ad405479..1cb709c1de3 100644
--- a/spec/features/admin/admin_users_spec.rb
+++ b/spec/features/admin/admin_users_spec.rb
@@ -144,8 +144,8 @@ describe "Admin::Users", feature: true do
before { click_link 'Impersonate' }
it 'logs in as the user when impersonate is clicked' do
- page.within '.sidebar-user .username' do
- expect(page).to have_content(another_user.username)
+ page.within '.sidebar-wrapper' do
+ expect(page.find('.sidebar-user')['data-user']).to eql(another_user.username)
end
end
@@ -158,8 +158,8 @@ describe "Admin::Users", feature: true do
it 'can log out of impersonated user back to original user' do
find(:css, 'li.impersonation a').click
- page.within '.sidebar-user .username' do
- expect(page).to have_content(@user.username)
+ page.within '.sidebar-wrapper' do
+ expect(page.find('.sidebar-user')['data-user']).to eql(@user.username)
end
end