fix specs

This commit is contained in:
James Lopez 2017-06-22 16:54:54 +02:00
parent 12dc3992ea
commit e2e0b175ae
2 changed files with 4 additions and 4 deletions

View File

@ -156,11 +156,11 @@ class Admin::UsersController < Admin::ApplicationController
respond_to do |format|
if success
format.html { redirect_back_or_admin_user(notice: "Successfully removed email.") }
format.html { redirect_back_or_admin_user(notice: 'Successfully removed email.') }
format.json { head :ok }
else
format.html { redirect_back_or_admin_user(alert: result[:message]) }
format.json { render json: result[:message], status: result[:status] }
format.html { redirect_back_or_admin_user(alert: 'There was an error removing the e-mail.') }
format.json { render json: 'There was an error removing the e-mail.', status: 400 }
end
end
end

View File

@ -10,7 +10,7 @@ module Users
def execute(skip_authorization: false, validate: true, &block)
assign_attributes(skip_authorization, &block)
if @user.save(validate: validate) || @user.errors.empty?
if @user.save(validate: validate)
success
else
error(@user.errors.full_messages.uniq.join('. '))