diff options
author | HombreLaser <sebastian-440@live.com> | 2023-03-25 00:10:33 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-03-25 00:10:33 -0600 |
commit | 7265af094ed16c36632128bccdcf84a3796c2359 (patch) | |
tree | 6d4f49752e0256b7c5ef2fc3e7db917be67db7bf /app/controllers/api | |
parent | 76d44f91efab14dc0eeb84e83a77a85a7bb7fd74 (diff) |
Añade specs de addresscontroller
Diffstat (limited to 'app/controllers/api')
-rw-r--r-- | app/controllers/api/addresses_controller.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/api/addresses_controller.rb b/app/controllers/api/addresses_controller.rb index e233fcc..3319607 100644 --- a/app/controllers/api/addresses_controller.rb +++ b/app/controllers/api/addresses_controller.rb @@ -10,7 +10,7 @@ module Api end def create - @service = Services::CreateAddressService.new(current_user_account, service_params) + @service = Services::Addresses::CreateAddressService.new(current_user_account, service_params) begin unless @service.call @@ -27,7 +27,7 @@ module Api end def update - @service = Services::UpdateAddressService.new(current_user_account, params[:id], service_params) + @service = Services::Addresses::UpdateAddressService.new(current_user_account, params[:id], service_params) begin case @service.call @@ -45,11 +45,11 @@ module Api end def destroy - @address = Address.find_by(id: params[:id]) + @address = current_user_account.addresses.find_by(id: params[:id]) render json: { error_message: 'Not found' }, status: :not_found and return if @address.nil? - @address.destroy + Services::Addresses::DestroyAddressService.new(current_user_account, params, @address).call render status: :see_other end |