Sha256: 00b1f5d98aa0c923f6f7ab81fc2acc2ba43315f6c21e7b29f945fe2a43158374

Contents?: true

Size: 1.26 KB

Versions: 5

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.all
      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

5 entries across 5 versions & 1 rubygems

Version Path
stripe-1.28.1 test/stripe/product_test.rb
stripe-1.28.0 test/stripe/product_test.rb
stripe-1.27.2 test/stripe/product_test.rb
stripe-1.27.1 test/stripe/product_test.rb
stripe-1.27.0 test/stripe/product_test.rb