diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2017-09-13 12:18:15 +0100 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-11-20 18:02:41 +0100 |
commit | 053a1988467acecfdc941f13f183d28fb0a11f1c (patch) | |
tree | 5208f0b550a6016ecf7f771699892a33f42936a5 /spec/features/admin/admin_users_spec.rb | |
parent | 7a61a8e09bcab5e0cb37ddb13900a5c07ef18918 (diff) | |
download | gitlab-ce-053a1988467acecfdc941f13f183d28fb0a11f1c.tar.gz |
Impersonation no longer gets stuck on password change.
Diffstat (limited to 'spec/features/admin/admin_users_spec.rb')
-rw-r--r-- | spec/features/admin/admin_users_spec.rb | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index b47f9055d29..a69b428d117 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -167,19 +167,36 @@ describe "Admin::Users" do it 'sees impersonation log out icon' do icon = first('.fa.fa-user-secret') - expect(icon).not_to eql nil + expect(icon).not_to be nil end it 'logs out of impersonated user back to original user' do find(:css, 'li.impersonation a').click - expect(page.find(:css, '.header-user .profile-link')['data-user']).to eql(current_user.username) + expect(page.find(:css, '.header-user .profile-link')['data-user']).to eq(current_user.username) end it 'is redirected back to the impersonated users page in the admin after stopping' do find(:css, 'li.impersonation a').click - expect(current_path).to eql "/admin/users/#{another_user.username}" + expect(current_path).to eq("/admin/users/#{another_user.username}") + end + end + + context 'when impersonating a user with an expired password' do + before do + another_user.update(password_expires_at: Time.now - 5.minutes) + click_link 'Impersonate' + end + + it 'does not redirect to password change page' do + expect(current_path).to eq('/') + end + + it 'is redirected back to the impersonated users page in the admin after stopping' do + find(:css, 'li.impersonation a').click + + expect(current_path).to eq("/admin/users/#{another_user.username}") end end end |