Skip to content

Commit 09d91a9

Browse files
committed
Add specs to Iugu::Subscription.create to spec when we create an invoice and when not
1 parent c22729d commit 09d91a9

File tree

3 files changed

+146
-0
lines changed

3 files changed

+146
-0
lines changed

spec/cassettes/Iugu_Subscription/_create/should_create_a_subscription_and_an_invoice_when_it_is_about_to_expire.yml

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

spec/cassettes/Iugu_Subscription/_create/should_create_a_subscription_but_not_an_invoice_when_it_will_expire_5_five_days_from_now.yml

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

spec/subscription_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,23 @@
1111
expect(subscription.is_new?).to be_falsy
1212
expect(subscription.id).to_not be_nil
1313
end
14+
15+
it 'should create a subscription and an invoice when it is about to expire', :vcr do
16+
subscription = Iugu::Subscription.create(plan_identifier: 'basic',
17+
customer_id: '8941A38AB8BF4BBAA595C0E03F379C9C',
18+
expires_at: Date.new(2018, 1, 4))
19+
20+
expect(subscription.recent_invoices.size).to eq(1)
21+
end
22+
23+
it 'should create a subscription but not an invoice when it will expire 5 five days from now', :vcr do
24+
subscription = Iugu::Subscription.create(plan_identifier: 'basic',
25+
payable_with: 'credit_card',
26+
customer_id: '8941A38AB8BF4BBAA595C0E03F379C9C',
27+
expires_at: Date.new(2018, 1, 10))
28+
29+
expect(subscription.recent_invoices.size).to eq(0)
30+
end
1431
end
1532

1633
describe '.fetch' do

0 commit comments

Comments
 (0)