From 8d066ca608c766b361aa8c358bd22f79be55cbbf Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Wed, 6 Aug 2014 15:37:25 -0700 Subject: [PATCH] Add coupon update --- lib/stripe/coupon.rb | 1 + test/stripe/coupon_test.rb | 11 ++++++++++- test/test_helper.rb | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/stripe/coupon.rb b/lib/stripe/coupon.rb index 750bf45a..aeb7f4d2 100644 --- a/lib/stripe/coupon.rb +++ b/lib/stripe/coupon.rb @@ -1,6 +1,7 @@ module Stripe class Coupon < APIResource include Stripe::APIOperations::Create + include Stripe::APIOperations::Update include Stripe::APIOperations::Delete include Stripe::APIOperations::List end diff --git a/test/stripe/coupon_test.rb b/test/stripe/coupon_test.rb index 34084b24..b53d9f5b 100644 --- a/test/stripe/coupon_test.rb +++ b/test/stripe/coupon_test.rb @@ -7,5 +7,14 @@ module Stripe c = Stripe::Coupon.create assert_equal "co_test_coupon", c.id end + + should "coupons should be updateable" do + @mock.expects(:get).once.returns(test_response(test_coupon)) + @mock.expects(:post).once.returns(test_response(test_coupon)) + c = Stripe::Coupon.new("test_coupon") + c.refresh + c.metadata['foo'] = 'bar' + c.save + end end -end \ No newline at end of file +end diff --git a/test/test_helper.rb b/test/test_helper.rb index e80106ee..cf5e194c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -201,7 +201,8 @@ def test_coupon(params={}) :duration_in_months => 3, :percent_off => 25, :id => "co_test_coupon", - :object => "coupon" + :object => "coupon", + :metadata => {}, }.merge(params) end