Skip to content
Snippets Groups Projects
Commit ad44af2f authored by James Lopez's avatar James Lopez
Browse files

fixed specs

parent 7aaf3692
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -511,7 +511,7 @@ module API
not_found!('Email') unless email
 
email.destroy
::Users::UpdateService.new(current_user, user).execute do |user|
::Users::UpdateService.new(current_user, current_user).execute do |user|
user.update_secondary_emails!
end
end
Loading
Loading
Loading
Loading
@@ -19,7 +19,7 @@ describe Emails::CreateService, services: true do
end
 
it 'does not create an email if the user has no permissions' do
expect { described_class.new(create(:user), user, opts).execute }.not_to change { Email.count }
expect { described_class.new(create(:user), user, opts).execute }.to raise_error(Gitlab::Access::AccessDeniedError)
end
 
it 'creates an email if we skip authorization' do
Loading
Loading
Loading
Loading
@@ -12,12 +12,14 @@ describe Emails::DestroyService, services: true do
end
 
it 'does not remove an email if the user has no permissions' do
expect { described_class.new(create(:user), user, opts).execute }.not_to change { Email.count }
expect do
described_class.new(create(:user), user, email: email.email).execute
end.to raise_error(Gitlab::Access::AccessDeniedError)
end
 
it 'removes an email if we skip authorization' do
expect do
described_class.new(create(:user), user, opts).execute(skip_authorization: true)
described_class.new(create(:user), user, email: email.email).execute(skip_authorization: true)
end.to change { Email.count }.by(-1)
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment