Sha256: e6d45a99412ec473ae0da28e13300e257f89c55ab90f7259030cd9c04689aa2d
Contents?: true
Size: 1.34 KB
Versions: 20
Compression:
Stored size: 1.34 KB
Contents
require File.expand_path('../../test_helper', __FILE__) module Stripe class CouponTest < Test::Unit::TestCase FIXTURE = API_FIXTURES.fetch(:coupon) should "be listable" do coupons = Stripe::Coupon.list assert_requested :get, "#{Stripe.api_base}/v1/coupons" assert coupons.data.kind_of?(Array) assert coupons.first.kind_of?(Stripe::Coupon) end should "be retrievable" do coupon = Stripe::Coupon.retrieve(FIXTURE[:id]) assert_requested :get, "#{Stripe.api_base}/v1/coupons/#{FIXTURE[:id]}" assert coupon.kind_of?(Stripe::Coupon) end should "be creatable" do coupon = Stripe::Coupon.create( percent_off: 25, duration: 'repeating', duration_in_months: 3, id: '25OFF' ) assert_requested :post, "#{Stripe.api_base}/v1/coupons" assert coupon.kind_of?(Stripe::Coupon) end should "be saveable" do coupon = Stripe::Coupon.retrieve(FIXTURE[:id]) coupon.metadata['key'] = 'value' coupon.save assert_requested :post, "#{Stripe.api_base}/v1/coupons/#{FIXTURE[:id]}" end should "be updateable" do coupon = Stripe::Coupon.update(FIXTURE[:id], metadata: { key: 'value' }) assert_requested :post, "#{Stripe.api_base}/v1/coupons/#{FIXTURE[:id]}" assert coupon.kind_of?(Stripe::Coupon) end end end
Version data entries
20 entries across 20 versions & 1 rubygems