-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace deprecated Stripe save calls
These have been replaced with calls to `create` or `update`.
- Loading branch information
Showing
6 changed files
with
50 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'spec_helper' | ||
require 'stripe_mock' | ||
|
||
RSpec.describe AlaveteliPro::SubscriptionCollection do | ||
let(:collection) { described_class.new(customer) } | ||
|
@@ -26,20 +27,39 @@ | |
end | ||
end | ||
|
||
describe '#build' do | ||
describe '#create' do | ||
before { StripeMock.start } | ||
after { StripeMock.stop } | ||
|
||
let(:stripe_helper) { StripeMock.create_test_helper } | ||
|
||
let(:product) { stripe_helper.create_product } | ||
|
||
let(:plan) do | ||
stripe_helper.create_plan( | ||
id: 'pro', product: product.id, amount: 1000 | ||
) | ||
end | ||
|
||
let(:customer) do | ||
Stripe::Customer.create( | ||
email: '[email protected]', source: stripe_helper.generate_card_token | ||
) | ||
end | ||
|
||
let(:collection) { described_class.new(customer) } | ||
let(:subscription) { collection.build } | ||
let(:subscription) { collection.create(plan: plan.id) } | ||
|
||
it 'should build new subscription' do | ||
it 'should create new subscription' do | ||
expect(subscription).to be_a AlaveteliPro::Subscription | ||
end | ||
|
||
it 'should delegated to a Stripe subscription' do | ||
expect(subscription.__getobj__).to be_a Stripe::Subscription | ||
end | ||
|
||
it 'should set customer object' do | ||
expect(subscription.customer).to eq customer | ||
it 'should set customer ID' do | ||
expect(subscription.customer).to eq customer.id | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters