Commit 2419a386 authored by James Lopez's avatar James Lopez

Merge branch 'fix_error_removing_secondary_email' into 'master'

Fix error removing secondary email

Closes #211968

See merge request gitlab-org/gitlab!28267
parents 2fd91cff f8593b21
......@@ -13,7 +13,7 @@ module Emails
user.update_secondary_emails!
end
result[:status] == 'success'
result[:status] == :success
end
end
end
......
---
title: Fix error removing secondary email
merge_request: 28267
author: Lee Tickett
type: fixed
......@@ -340,6 +340,17 @@ describe Admin::UsersController do
end
end
describe "DELETE #remove_email" do
it 'deletes the email' do
email = create(:email, user: user)
delete :remove_email, params: { id: user.username, email_id: email.id }
expect(user.reload.emails).not_to include(email)
expect(flash[:notice]).to eq('Successfully removed email.')
end
end
describe "POST impersonate" do
context "when the user is blocked" do
before do
......
......@@ -10,7 +10,10 @@ describe Emails::DestroyService do
describe '#execute' do
it 'removes an email' do
expect { service.execute(email) }.to change { user.emails.count }.by(-1)
response = service.execute(email)
expect(user.emails).not_to include(email)
expect(response).to be true
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment