Sha256: ccd4e3a990f6b993b189f611b0658856923661b84497257e04e2d2c7b95ff944

Contents?: true

Size: 1.66 KB

Versions: 10

Compression:

Stored size: 1.66 KB

Contents

# frozen_string_literal: true

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

module Stripe
  class InvoiceItemTest < Test::Unit::TestCase
    should "be listable" do
      invoiceitems = Stripe::InvoiceItem.list
      assert_requested :get, "#{Stripe.api_base}/v1/invoiceitems"
      assert invoiceitems.data.is_a?(Array)
      assert invoiceitems.first.is_a?(Stripe::InvoiceItem)
    end

    should "be retrievable" do
      item = Stripe::InvoiceItem.retrieve("ii_123")
      assert_requested :get,
                       "#{Stripe.api_base}/v1/invoiceitems/ii_123"
      assert item.is_a?(Stripe::InvoiceItem)
    end

    should "be creatable" do
      item = Stripe::InvoiceItem.create(
        amount: 100,
        currency: "USD",
        customer: "cus_123"
      )
      assert_requested :post,
                       "#{Stripe.api_base}/v1/invoiceitems"
      assert item.is_a?(Stripe::InvoiceItem)
    end

    should "be saveable" do
      item = Stripe::InvoiceItem.retrieve("ii_123")
      item.metadata["key"] = "value"
      item.save
      assert_requested :post,
                       "#{Stripe.api_base}/v1/invoiceitems/#{item.id}"
    end

    should "be updateable" do
      item = Stripe::InvoiceItem.update("ii_123", metadata: { key: "value" })
      assert_requested :post,
                       "#{Stripe.api_base}/v1/invoiceitems/ii_123"
      assert item.is_a?(Stripe::InvoiceItem)
    end

    should "be deletable" do
      item = Stripe::InvoiceItem.retrieve("ii_123")
      item = item.delete
      assert_requested :delete,
                       "#{Stripe.api_base}/v1/invoiceitems/#{item.id}"
      assert item.is_a?(Stripe::InvoiceItem)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
stripe-3.23.0 test/stripe/invoice_item_test.rb
stripe-3.22.0 test/stripe/invoice_item_test.rb
stripe-3.21.0 test/stripe/invoice_item_test.rb
stripe-3.20.0 test/stripe/invoice_item_test.rb
stripe-3.19.0 test/stripe/invoice_item_test.rb
stripe-3.18.0 test/stripe/invoice_item_test.rb
stripe-3.17.2 test/stripe/invoice_item_test.rb
stripe-3.17.1 test/stripe/invoice_item_test.rb
stripe-3.17.0 test/stripe/invoice_item_test.rb
stripe-3.15.0 test/stripe/invoice_item_test.rb