Sha256: e21a8eee2b6b2b2572b2a338286379d778dcf72d51649233cfcb3e0023d182ff

Contents?: true

Size: 1.33 KB

Versions: 14

Compression:

Stored size: 1.33 KB

Contents

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

module Stripe
  class ProductTest < Test::Unit::TestCase
    should "products should be listable" do
      @mock.expects(:get).once.returns(make_response(make_product_array))
      products = Stripe::Product.list
      assert products.data.kind_of?(Array)
      products.each do |product|
        assert product.kind_of?(Stripe::Product)
      end
    end

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

      p = Stripe::Product.retrieve("test_product")
      p.delete
      assert p.deleted
    end

    should "products should be updateable" do
      @mock.expects(:get).once.returns(make_response(make_product))
      @mock.expects(:post).once.returns(make_response(make_product))
      p = Stripe::Product.new("test_product")
      p.refresh
      p.description = "New product description"
      p.save
    end

    should "products should allow metadata updates" do
      @mock.expects(:get).once.returns(make_response(make_product))
      @mock.expects(:post).once.returns(make_response(make_product))
      p = Stripe::Product.new("test_product")
      p.refresh
      p.metadata['key'] = 'value'
      p.save
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
stripe-1.43.1 test/stripe/product_test.rb
stripe-1.43.0 test/stripe/product_test.rb
stripe-1.42.0 test/stripe/product_test.rb
stripe-1.41.0 test/stripe/product_test.rb
stripe-1.40.0 test/stripe/product_test.rb
stripe-1.39.0 test/stripe/product_test.rb
stripe-1.38.0 test/stripe/product_test.rb
stripe-1.37.0 test/stripe/product_test.rb
stripe-1.36.2 test/stripe/product_test.rb
stripe-1.36.1 test/stripe/product_test.rb
stripe-1.36.0 test/stripe/product_test.rb
stripe-1.35.1 test/stripe/product_test.rb
stripe-1.35.0 test/stripe/product_test.rb
stripe-1.34.0 test/stripe/product_test.rb