Commit f8593b21 authored by Lee Tickett's avatar Lee Tickett Committed by James Lopez

Fix error removing secondary email

parent d08508b9
...@@ -13,7 +13,7 @@ module Emails ...@@ -13,7 +13,7 @@ module Emails
user.update_secondary_emails! user.update_secondary_emails!
end end
result[:status] == 'success' result[:status] == :success
end end
end 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 ...@@ -340,6 +340,17 @@ describe Admin::UsersController do
end end
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 describe "POST impersonate" do
context "when the user is blocked" do context "when the user is blocked" do
before do before do
......
...@@ -10,7 +10,10 @@ describe Emails::DestroyService do ...@@ -10,7 +10,10 @@ describe Emails::DestroyService do
describe '#execute' do describe '#execute' do
it 'removes an email' 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 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