Skip to content
Snippets Groups Projects
Commit 05e72272 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Set user data in profile link in the header

parent 7facedfb
No related branches found
No related tags found
No related merge requests found
Loading
@@ -45,7 +45,7 @@
Loading
@@ -45,7 +45,7 @@
.dropdown-menu-nav.dropdown-menu-align-right .dropdown-menu-nav.dropdown-menu-align-right
%ul %ul
%li %li
= link_to "Profile", current_user = link_to "Profile", current_user, class: 'profile-link', data: { user: current_user.username }
%li %li
= link_to "Profile Settings", profile_path = link_to "Profile Settings", profile_path
%li.divider %li.divider
Loading
Loading
Loading
@@ -144,9 +144,7 @@ describe "Admin::Users", feature: true do
Loading
@@ -144,9 +144,7 @@ describe "Admin::Users", feature: true do
before { click_link 'Impersonate' } before { click_link 'Impersonate' }
   
it 'logs in as the user when impersonate is clicked' do it 'logs in as the user when impersonate is clicked' do
page.within '.sidebar-wrapper' do expect(page.find(:css, '.header-user .profile-link')['data-user']).to eql(another_user.username)
expect(page.find('.sidebar-user')['data-user']).to eql(another_user.username)
end
end end
   
it 'sees impersonation log out icon' do it 'sees impersonation log out icon' do
Loading
@@ -158,9 +156,7 @@ describe "Admin::Users", feature: true do
Loading
@@ -158,9 +156,7 @@ describe "Admin::Users", feature: true do
it 'can log out of impersonated user back to original user' do it 'can log out of impersonated user back to original user' do
find(:css, 'li.impersonation a').click find(:css, 'li.impersonation a').click
   
page.within '.sidebar-wrapper' do expect(page.find(:css, '.header-user .profile-link')['data-user']).to eql(@user.username)
expect(page.find('.sidebar-user')['data-user']).to eql(@user.username)
end
end end
   
it 'is redirected back to the impersonated users page in the admin after stopping' do it 'is redirected back to the impersonated users page in the admin after stopping' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment