fixed specs
This commit is contained in:
parent
7aaf3692b3
commit
ad44af2faa
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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…
Reference in New Issue