diff options
author | Jamie Schembri <jamie@schembri.me> | 2018-06-23 19:50:50 +0200 |
---|---|---|
committer | Jamie Schembri <jamie@schembri.me> | 2018-06-27 19:15:17 +0200 |
commit | 6cfc5c6a5ed80d2b4fc3793ee08fc47706ecef6d (patch) | |
tree | 4c13d0bbdda1d7cf1c7fda0bca312adfe63bb598 /spec/features/uploads | |
parent | 2bac2918b2d6f12d94f739f4b6865b9e9221c642 (diff) | |
download | gitlab-ce-6cfc5c6a5ed80d2b4fc3793ee08fc47706ecef6d.tar.gz |
Fix #39604 - Update header avatar after user changes avatar
Diffstat (limited to 'spec/features/uploads')
-rw-r--r-- | spec/features/uploads/user_uploads_avatar_to_profile_spec.rb | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/spec/features/uploads/user_uploads_avatar_to_profile_spec.rb b/spec/features/uploads/user_uploads_avatar_to_profile_spec.rb index 52003bb0859..766bb4f09cd 100644 --- a/spec/features/uploads/user_uploads_avatar_to_profile_spec.rb +++ b/spec/features/uploads/user_uploads_avatar_to_profile_spec.rb @@ -1,17 +1,16 @@ require 'rails_helper' feature 'User uploads avatar to profile' do - scenario 'they see their new avatar' do - user = create(:user) - sign_in(user) + let!(:user) { create(:user) } + let(:avatar_file_path) { Rails.root.join('spec', 'fixtures', 'dk.png') } + before do + sign_in user visit profile_path - attach_file( - 'user_avatar', - Rails.root.join('spec', 'fixtures', 'dk.png'), - visible: false - ) + end + scenario 'they see their new avatar on their profile' do + attach_file('user_avatar', avatar_file_path, visible: false) click_button 'Update profile settings' visit user_path(user) @@ -21,4 +20,16 @@ feature 'User uploads avatar to profile' do # Cheating here to verify something that isn't user-facing, but is important expect(user.reload.avatar.file).to exist end + + scenario 'their new avatar is immediately visible in the header', :js do + find('.js-user-avatar-input', visible: false).set(avatar_file_path) + + click_button 'Set new profile picture' + click_button 'Update profile settings' + + wait_for_all_requests + + data_uri = find('.avatar-image .avatar')['src'] + expect(page.find('.header-user-avatar')['src']).to eq data_uri + end end |