Ensure delete parameters are passed through for subscriptions.

This commit is contained in:
Pat Allan 2014-01-22 17:42:37 +11:00
parent d6ebab3310
commit b0f0c03990
2 changed files with 7 additions and 6 deletions

View File

@ -1,8 +1,8 @@
module Stripe
module APIOperations
module Delete
def delete
response, api_key = Stripe.request(:delete, url, @api_key)
def delete(params = {})
response, api_key = Stripe.request(:delete, url, @api_key, params)
refresh_from(response, api_key)
self
end

View File

@ -22,13 +22,14 @@ module Stripe
should "subscriptions should be deletable" do
@mock.expects(:get).once.returns(test_response(test_customer))
@mock.expects(:delete).once.returns(test_response(test_subscription({:deleted => true})))
customer = Stripe::Customer.retrieve('test_customer')
subscription = customer.subscriptions.first
subscription.delete
assert subscription.deleted
@mock.expects(:delete).once.with("#{Stripe.api_base}/v1/customers/c_test_customer/subscriptions/#{subscription.id}?at_period_end=true", nil, nil).returns(test_response(test_subscription))
subscription.delete :at_period_end => true
@mock.expects(:delete).once.with("#{Stripe.api_base}/v1/customers/c_test_customer/subscriptions/#{subscription.id}", nil, nil).returns(test_response(test_subscription))
subscription.delete
end
should "subscriptions should be updateable" do