Skip to content

Commit

Permalink
fixes specs
Browse files Browse the repository at this point in the history
  • Loading branch information
tansengming committed Aug 8, 2024
1 parent 6dd5647 commit 3e77e34
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions test/plan_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
describe 'when none exists on stripe.com' do
let(:headers) { load_request_fixture('stripe_plans_headers_2017.json') }
before do
Stripe.api_version = '2018-02-04'
Stripe::Plan.stubs(:retrieve).raises(Stripe::InvalidRequestError.new("not found", "id"))

stub_request(:get, "https://api.stripe.com/v1/plans").
Expand All @@ -212,26 +213,26 @@

it 'creates the plan online' do
Stripe::Plan.expects(:create).with(
:id => :gold,
:currency => 'usd',
:name => 'Solid Gold',
:amount => 699,
:interval => 'month',
:interval_count => 1,
:trial_period_days => 0
id: :gold,
currency: 'usd',
name: 'Solid Gold',
amount: 699,
interval: 'month',
interval_count: 1,
trial_period_days: 0
)
Stripe::Plans::GOLD.put!
end

it 'creates a plan with an alternative currency' do
Stripe::Plan.expects(:create).with(
:id => :alternative_currency,
:currency => 'cad',
:name => 'Alternative Currency',
:amount => 699,
:interval => 'month',
:interval_count => 1,
:trial_period_days => 0
id: :alternative_currency,
currency: 'cad',
name: 'Alternative Currency',
amount: 699,
interval: 'month',
interval_count: 1,
trial_period_days: 0
)
Stripe::Plans::ALTERNATIVE_CURRENCY.put!
end
Expand Down Expand Up @@ -384,16 +385,16 @@

it 'creates the plan online' do
Stripe::Plan.expects(:create).with(
:id => :gold,
:currency => 'usd',
:product => {
:name => 'Solid Gold',
:statement_descriptor => nil,
id: :gold,
currency: 'usd',
product: {
name: 'Solid Gold',
statement_descriptor: nil,
},
:amount => 699,
:interval => 'month',
:interval_count => 1,
:trial_period_days => 0
amount: 699,
interval: 'month',
interval_count: 1,
trial_period_days: 0
)

subject
Expand Down

0 comments on commit 3e77e34

Please sign in to comment.