Skip to content

Commit

Permalink
Fix some parameters being sent in tests
Browse files Browse the repository at this point in the history
I found a bug recently in stripe-mock which causes it not to actually be
validating that parameters not in the spec are not being sent (the
actual Stripe API does check for this).

After applying a fix, I found that stripe-ruby's test suite no longer
passes against it, and the reason is that there are some subtle mistakes
throughout. This patch corrects them to be in line with what the API
actually expects.
  • Loading branch information
brandur committed May 16, 2018
1 parent e8b2726 commit ed2a0f0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/stripe/customer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CustomerTest < Test::Unit::TestCase
context "#create_subscription" do
should "create a new subscription" do
customer = Stripe::Customer.retrieve("cus_123")
subscription = customer.create_subscription(plan: "silver")
subscription = customer.create_subscription(items: [{ plan: "silver" }])
assert subscription.is_a?(Stripe::Subscription)
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/stripe/order_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ class OrderTest < Test::Unit::TestCase
context "#pay" do
should "pay an order" do
order = Stripe::Order.retrieve("or_123")
order = order.pay(token: "tok_123")
order = order.pay(source: "tok_123")
assert order.is_a?(Stripe::Order)
end
end

context "#return_order" do
should "return an order" do
order = Stripe::Order.retrieve("or_123")
order = order.return_order(orders: [
order = order.return_order(items: [
{ parent: "sku_123" },
])
assert order.is_a?(Stripe::OrderReturn)
Expand Down
1 change: 0 additions & 1 deletion test/stripe/subscription_item_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class SubscriptionItemTest < Test::Unit::TestCase

should "be creatable" do
item = Stripe::SubscriptionItem.create(
item: "silver",
plan: "sapphire-elite",
quantity: 3,
subscription: "sub_123"
Expand Down

0 comments on commit ed2a0f0

Please sign in to comment.