Sha256: a1200f0c57e1bb2a9ea0ae592ce5fb4c3b829e9d06d9c2cbb9bd85b78d1edc7b

Contents?: true

Size: 1 KB

Versions: 21

Compression:

Stored size: 1 KB

Contents

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

module Stripe
  class SKUTest < Test::Unit::TestCase
    should "SKUs should be listable" do
      @mock.expects(:get).once.
        returns(make_response(make_sku_array("test_product")))
      skus = Stripe::SKU.list
      assert skus.data.kind_of? Array
      skus.each do |sku|
        assert sku.kind_of?(Stripe::SKU)
      end
    end

    should "SKUs should be updateable" do
      @mock.expects(:post).once.
        with("#{Stripe.api_base}/v1/skus/test_sku", nil, 'metadata[foo]=bar').
        returns(make_response(make_sku(:metadata => {foo: 'bar'})))
      s = Stripe::SKU.update("test_sku", metadata: {foo: 'bar'})
      assert_equal 'bar', s.metadata['foo']
    end

    should "SKUs should be deletable" do
      @mock.expects(:get).once.returns(make_response(make_sku))
      @mock.expects(:delete).once.returns(make_response(make_sku(:deleted => true)))

      s = Stripe::SKU.retrieve("test_sku")
      s.delete
      assert s.deleted
    end

  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

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