Skip to content

Commit e9f4bb2

Browse files
author
Lucas
committed
Add specs to Iugu::Customer#delete
1 parent 24ec9dc commit e9f4bb2

File tree

3 files changed

+205
-1
lines changed

3 files changed

+205
-1
lines changed

lib/iugu/api_delete.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Iugu
22
module APIDelete
33
def delete
4-
APIRequest.request "DELETE", self.class.url(self.attributes)
4+
APIRequest.request('DELETE', self.class.url(self.attributes))
55
self.errors = nil
66
true
77
rescue Iugu::RequestWithErrors => ex

spec/cassettes/Iugu_Customer/_delete/should_save_the_customer.yml

Lines changed: 183 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/customer_spec.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,25 @@
109109
expect(new_customer.complement).to eq('321A')
110110
end
111111
end
112+
113+
describe '.delete', :vcr do
114+
it 'should save the customer' do
115+
customer = Iugu::Customer.create(email: '[email protected]',
116+
name: 'John Snow',
117+
cpf_cnpj: '648.144.103-01',
118+
cc_emails: '[email protected]',
119+
zip_code: '29190560',
120+
number: '8',
121+
street: 'Rua dos Bobos',
122+
city: 'São Paulo',
123+
state: 'SP',
124+
district: 'Mooca',
125+
complement: '123C')
126+
customer.delete
127+
128+
expect {
129+
Iugu::Customer.fetch(id: customer.id)
130+
}.to raise_error(Iugu::ObjectNotFound)
131+
end
132+
end
112133
end

0 commit comments

Comments
 (0)