diff --git a/app/use_cases/customer_use_case/delete.rb b/app/use_cases/customer_use_case/delete.rb index 6ed92b2..0c99cc0 100644 --- a/app/use_cases/customer_use_case/delete.rb +++ b/app/use_cases/customer_use_case/delete.rb @@ -8,7 +8,7 @@ def initialize(id) end def call - return customer.destroy! if balance? + return customer.destroy! if customer.balance.zero? raise SharedErrors::BalanceEmpty end @@ -18,11 +18,7 @@ def call attr_reader :id def customer - @customer = Customer.includes(:transactions).find(@id) - end - - def balance? - customer.balance.zero? + Customer.includes(:transactions).find(@id) end end end