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

fix spec failures

parent 0ee002c7
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -236,7 +236,9 @@ module API
user = User.find_by(id: params.delete(:id))
not_found!('User') unless user
 
if Emails::CreateService.new(current_user, user, declared_params(include_missing: false)).execute(skip_authorization: true)
email = Emails::CreateService.new(current_user, user, declared_params(include_missing: false)).execute
if email.errors.blank?
NotificationService.new.new_email(email)
present email, with: Entities::Email
else
Loading
Loading
@@ -274,7 +276,7 @@ module API
email = user.emails.find_by(id: params[:email_id])
not_found!('Email') unless email
 
Emails::DestroyService.new(current_user, user, email: email.email).execute(skip_authorization: true)
Emails::DestroyService.new(current_user, user, email: email.email).execute
end
 
desc 'Delete a user. Available only for admins.' do
Loading
Loading
@@ -486,9 +488,9 @@ module API
requires :email, type: String, desc: 'The new email'
end
post "emails" do
email = current_user.emails.new(declared_params)
email = Emails::CreateService.new(current_user, current_user, declared_params).execute
 
if Emails::CreateService.new(current_user, current_user, declared_params).execute
if email.errors.blank?
NotificationService.new.new_email(email)
present email, with: Entities::Email
else
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