Sha256: 4c18dcb8acca04e428a15cc263f631ec49e6ad04571d863346426a042183aa77

Contents?: true

Size: 1.72 KB

Versions: 29

Compression:

Stored size: 1.72 KB

Contents

# frozen_string_literal: true

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

module Stripe
  module Issuing
    class CardTest < Test::Unit::TestCase
      should "be creatable" do
        card = Stripe::Issuing::Card.create(
          currency: "usd",
          type: "physical"
        )
        assert_requested :post, "#{Stripe.api_base}/v1/issuing/cards"
        assert card.is_a?(Stripe::Issuing::Card)
      end

      should "be listable" do
        cards = Stripe::Issuing::Card.list
        assert_requested :get, "#{Stripe.api_base}/v1/issuing/cards"
        assert cards.data.is_a?(Array)
        assert cards.data[0].is_a?(Stripe::Issuing::Card)
      end

      should "be retrievable" do
        card = Stripe::Issuing::Card.retrieve("ic_123")
        assert_requested :get, "#{Stripe.api_base}/v1/issuing/cards/ic_123"
        assert card.is_a?(Stripe::Issuing::Card)
      end

      should "be saveable" do
        card = Stripe::Issuing::Card.retrieve("ic_123")
        card.metadata["key"] = "value"
        card.save
        assert_requested :post, "#{Stripe.api_base}/v1/issuing/cards/ic_123"
        assert card.is_a?(Stripe::Issuing::Card)
      end

      should "be updateable" do
        card = Stripe::Issuing::Card.update("ic_123", metadata: { foo: "bar" })
        assert_requested :post, "#{Stripe.api_base}/v1/issuing/cards/ic_123"
        assert card.is_a?(Stripe::Issuing::Card)
      end

      should "be able to retrieve card details" do
        card = Stripe::Issuing::Card.retrieve("ic_123")

        card_details = card.details
        assert_requested :get, "#{Stripe.api_base}/v1/issuing/cards/ic_123/details"
        assert card_details.is_a?(Stripe::Issuing::CardDetails)
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

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