From 43b78055aa73535e6689f20f6e0a27e325560ae8 Mon Sep 17 00:00:00 2001 From: Jacqueline Xu Date: Tue, 1 Aug 2017 17:09:10 -0700 Subject: [PATCH] Add upcoming invoice subscription items test --- test/stripe/invoice_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/stripe/invoice_test.rb b/test/stripe/invoice_test.rb index fa23b0bc..1b5ebb00 100644 --- a/test/stripe/invoice_test.rb +++ b/test/stripe/invoice_test.rb @@ -73,6 +73,26 @@ module Stripe assert invoice.kind_of?(Stripe::Invoice) end + should "retrieve upcoming invoices with items" do + items = [{ + plan: 'gold', + quantity: 2 + }] + + invoice = Stripe::Invoice.upcoming( + customer: "cus_123", + subscription_items: items + ) + + assert_requested :get, "#{Stripe.api_base}/v1/invoices/upcoming", + query: { + customer: "cus_123", + :'subscription_items[][plan]' => 'gold', + :'subscription_items[][quantity]' => 2 + } + assert invoice.kind_of?(Stripe::Invoice) + end + should "be callable with an empty string" do invoice = Stripe::Invoice.upcoming( coupon: '',