lib/fake_braintree/customer.rb in fake_braintree-0.6.0 vs lib/fake_braintree/customer.rb in fake_braintree-0.7.0

- old
+ new

@@ -1,5 +1,9 @@ +require 'fake_braintree/helpers' +require 'fake_braintree/credit_card' +require 'fake_braintree/valid_credit_cards' + module FakeBraintree class Customer include Helpers def initialize(customer_hash_from_params, options) @@ -37,12 +41,16 @@ response_for_customer_not_found end end def delete - delete_customer_with_id(customer_id) - deletion_response + if customer_exists_in_registry? + delete_customer_with_id(customer_id) + deletion_response + else + response_for_customer_not_found + end end private def invalid? @@ -143,10 +151,10 @@ [] end end def delete_customer_with_id(id) - FakeBraintree.registry.customers[id] = nil + FakeBraintree.registry.customers.delete(id) end def deletion_response gzipped_response(200, '') end