Sha256: 09313755caa67fc7e27917f4f0b41bdbf338746b7d93f9d3ee9ca25a4e0c2172

Contents?: true

Size: 1.26 KB

Versions: 11

Compression:

Stored size: 1.26 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 not be deletable" do
      assert_raises NoMethodError do
        @mock.expects(:get).once.returns(make_response(make_product))
        p = Stripe::Product.retrieve("test_product")
        p.delete
      end
    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

11 entries across 11 versions & 1 rubygems

Version Path
stripe-1.33.1 test/stripe/product_test.rb
stripe-1.33.0 test/stripe/product_test.rb
stripe-1.32.1 test/stripe/product_test.rb
stripe-1.32.0 test/stripe/product_test.rb
stripe-1.31.0 test/stripe/product_test.rb
stripe-1.30.3 test/stripe/product_test.rb
stripe-1.30.2 test/stripe/product_test.rb
stripe-1.30.1 test/stripe/product_test.rb
stripe-1.30.0 test/stripe/product_test.rb
stripe-1.29.1 test/stripe/product_test.rb
stripe-1.29.0 test/stripe/product_test.rb