diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-05-22 15:53:27 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-05-22 15:53:27 +0000 |
commit | 86c155a190ef55c8c7eb42c6045660ef895707e8 (patch) | |
tree | 6570dec317db9c10b4ad51f894ffcacb6f28aa32 /spec/requests/api | |
parent | 45ec7d15dd599597f98d1654096cb2837bb28a96 (diff) | |
parent | 3f73b6bee07b81814a623776338abe7b74885302 (diff) | |
download | gitlab-ce-86c155a190ef55c8c7eb42c6045660ef895707e8.tar.gz |
Merge branch '22846-notifications-broken-during-email-address-change-before-email-confirmed' into 'master'
Resolve "notifications broken during email address change before email confirmed"
Closes #22846
See merge request gitlab-org/gitlab-ce!18474
Diffstat (limited to 'spec/requests/api')
-rw-r--r-- | spec/requests/api/users_spec.rb | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index e8196980a8c..05637eb0729 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -488,10 +488,6 @@ describe API::Users do describe "PUT /users/:id" do let!(:admin_user) { create(:admin) } - before do - admin - end - it "updates user with new bio" do put api("/users/#{user.id}", admin), { bio: 'new test bio' } @@ -525,27 +521,28 @@ describe API::Users do expect(json_response['avatar_url']).to include(user.avatar_path) end - it 'updates user with his own email' do - put api("/users/#{user.id}", admin), email: user.email - - expect(response).to have_gitlab_http_status(200) - expect(json_response['email']).to eq(user.email) - expect(user.reload.email).to eq(user.email) - end - it 'updates user with a new email' do + old_email = user.email + old_notification_email = user.notification_email put api("/users/#{user.id}", admin), email: 'new@email.com' + user.reload + expect(response).to have_gitlab_http_status(200) - expect(user.reload.notification_email).to eq('new@email.com') + expect(user).to be_confirmed + expect(user.email).to eq(old_email) + expect(user.notification_email).to eq(old_notification_email) + expect(user.unconfirmed_email).to eq('new@email.com') end it 'skips reconfirmation when requested' do - put api("/users/#{user.id}", admin), { skip_reconfirmation: true } + put api("/users/#{user.id}", admin), email: 'new@email.com', skip_reconfirmation: true user.reload - expect(user.confirmed_at).to be_present + expect(response).to have_gitlab_http_status(200) + expect(user).to be_confirmed + expect(user.email).to eq('new@email.com') end it 'updates user with his own username' do |