Sha256: cf481251db8a092c1804ca23a136acd5d6244d928ba52f16c05ad88b63f2e18c

Contents?: true

Size: 975 Bytes

Versions: 21

Compression:

Stored size: 975 Bytes

Contents

require File.expand_path('../../test_helper', __FILE__)

module Stripe
  class CouponTest < Test::Unit::TestCase
    should "create should return a new coupon" do
      @mock.expects(:post).once.returns(make_response(make_coupon))
      c = Stripe::Coupon.create
      assert_equal "co_test_coupon", c.id
    end

    should "coupons should be saveable" do
      @mock.expects(:get).once.returns(make_response(make_coupon))
      @mock.expects(:post).once.returns(make_response(make_coupon))
      c = Stripe::Coupon.new("test_coupon")
      c.refresh
      c.metadata['foo'] = 'bar'
      c.save
    end

    should "coupons should be updateable" do
      @mock.expects(:post).once.
        with("https://api.stripe.com/v1/coupons/test_coupon", nil, "metadata[foo]=bar").
        returns(make_response(make_coupon(metadata: {foo: 'bar'})))
      c = Stripe::Coupon.update("test_coupon", metadata: {foo: 'bar'})
      assert_equal('bar', c.metadata['foo'])
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
stripe-1.58.0 test/stripe/coupon_test.rb
stripe-1.57.1 test/stripe/coupon_test.rb
stripe-1.57.0 test/stripe/coupon_test.rb
stripe-1.56.2 test/stripe/coupon_test.rb
stripe-1.56.1 test/stripe/coupon_test.rb
stripe-1.56.0 test/stripe/coupon_test.rb
stripe-1.55.1 test/stripe/coupon_test.rb
stripe-1.55.0 test/stripe/coupon_test.rb
stripe-1.54.0 test/stripe/coupon_test.rb
stripe-1.53.0 test/stripe/coupon_test.rb
stripe-1.52.0 test/stripe/coupon_test.rb
stripe-1.51.1 test/stripe/coupon_test.rb
stripe-1.51.0 test/stripe/coupon_test.rb
stripe-1.50.1 test/stripe/coupon_test.rb
stripe-1.50.0 test/stripe/coupon_test.rb
stripe-1.49.0 test/stripe/coupon_test.rb
stripe-1.48.0 test/stripe/coupon_test.rb
stripe-1.47.0 test/stripe/coupon_test.rb
stripe-1.46.0 test/stripe/coupon_test.rb
stripe-1.45.0 test/stripe/coupon_test.rb