Sha256: af85b312c43dfe35f0d55cd44283f22a3744152e0613d9e181719264f5cb1004

Contents?: true

Size: 1.4 KB

Versions: 29

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

require ::File.expand_path("../../test_helper", __FILE__)

module Stripe
  class SKUTest < Test::Unit::TestCase
    should "be listable" do
      skus = Stripe::SKU.list
      assert_requested :get, "#{Stripe.api_base}/v1/skus"
      assert skus.data.is_a?(Array)
      assert skus.data[0].is_a?(Stripe::SKU)
    end

    should "be retrievable" do
      sku = Stripe::SKU.retrieve("sku_123")
      assert_requested :get, "#{Stripe.api_base}/v1/skus/sku_123"
      assert sku.is_a?(Stripe::SKU)
    end

    should "be creatable" do
      _ = Stripe::SKU.create(
        currency: "USD",
        inventory: { type: "finite", quantity: 500 },
        price: 100,
        product: "prod_123"
      )
      assert_requested :post, "#{Stripe.api_base}/v1/skus"
    end

    should "be saveable" do
      sku = Stripe::SKU.retrieve("sku_123")
      sku.metadata["key"] = "value"
      sku.save
      assert_requested :post, "#{Stripe.api_base}/v1/skus/#{sku.id}"
    end

    should "be updateable" do
      sku = Stripe::SKU.update("sku_123", metadata: { foo: "bar" })
      assert_requested :post, "#{Stripe.api_base}/v1/skus/sku_123"
      assert sku.is_a?(Stripe::SKU)
    end

    should "be deletable" do
      sku = Stripe::SKU.retrieve("sku_123")
      sku = sku.delete
      assert_requested :delete, "#{Stripe.api_base}/v1/skus/#{sku.id}"
      assert sku.is_a?(Stripe::SKU)
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
stripe-4.11.0 test/stripe/sku_test.rb
stripe-4.10.0 test/stripe/sku_test.rb
stripe-4.9.1 test/stripe/sku_test.rb
stripe-4.9.0 test/stripe/sku_test.rb
stripe-4.8.1 test/stripe/sku_test.rb
stripe-4.8.0 test/stripe/sku_test.rb
stripe-4.7.1 test/stripe/sku_test.rb
stripe-4.7.0 test/stripe/sku_test.rb
stripe-4.6.0 test/stripe/sku_test.rb
stripe-4.5.0 test/stripe/sku_test.rb
stripe-4.4.1 test/stripe/sku_test.rb
stripe-4.4.0 test/stripe/sku_test.rb
stripe-4.3.0 test/stripe/sku_test.rb
stripe-4.2.0 test/stripe/sku_test.rb
stripe-4.1.0 test/stripe/sku_test.rb
stripe-4.0.3 test/stripe/sku_test.rb
stripe-4.0.2 test/stripe/sku_test.rb
stripe-4.0.1 test/stripe/sku_test.rb
stripe-4.0.0 test/stripe/sku_test.rb
stripe-3.31.1 test/stripe/sku_test.rb