Sha256: c51d494ef02797954cb6a4e8d6350186a940734f440fd679d0d5d8a6ffe40759

Contents?: true

Size: 1.81 KB

Versions: 52

Compression:

Stored size: 1.81 KB

Contents

# frozen_string_literal: true

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

module Stripe
  module Issuing
    class CardholderTest < Test::Unit::TestCase
      should "be creatable" do
        cardholder = Stripe::Issuing::Cardholder.create(
          billing: {
            address: {
              city: "city",
              country: "US",
              line1: "line1",
              postal_code: "postal_code",
            },
          },
          name: "Jenny Rosen",
          type: "individual"
        )
        assert_requested :post, "#{Stripe.api_base}/v1/issuing/cardholders"
        assert cardholder.is_a?(Stripe::Issuing::Cardholder)
      end

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

      should "be retrievable" do
        cardholder = Stripe::Issuing::Cardholder.retrieve("ich_123")
        assert_requested :get, "#{Stripe.api_base}/v1/issuing/cardholders/ich_123"
        assert cardholder.is_a?(Stripe::Issuing::Cardholder)
      end

      should "be saveable" do
        cardholder = Stripe::Issuing::Cardholder.retrieve("ich_123")
        cardholder.metadata["key"] = "value"
        cardholder.save
        assert_requested :post, "#{Stripe.api_base}/v1/issuing/cardholders/#{cardholder.id}"
        assert cardholder.is_a?(Stripe::Issuing::Cardholder)
      end

      should "be updateable" do
        cardholder = Stripe::Issuing::Cardholder.update("ich_123", metadata: { foo: "bar" })
        assert_requested :post, "#{Stripe.api_base}/v1/issuing/cardholders/ich_123"
        assert cardholder.is_a?(Stripe::Issuing::Cardholder)
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
stripe-5.31.0 test/stripe/issuing/cardholder_test.rb
stripe-5.30.0 test/stripe/issuing/cardholder_test.rb
stripe-5.29.1 test/stripe/issuing/cardholder_test.rb
stripe-5.29.0 test/stripe/issuing/cardholder_test.rb
stripe-5.28.0 test/stripe/issuing/cardholder_test.rb
stripe-5.27.0 test/stripe/issuing/cardholder_test.rb
stripe-5.26.0 test/stripe/issuing/cardholder_test.rb
stripe-5.25.0 test/stripe/issuing/cardholder_test.rb
stripe-5.24.0 test/stripe/issuing/cardholder_test.rb
stripe-5.23.1 test/stripe/issuing/cardholder_test.rb
stripe-5.23.0 test/stripe/issuing/cardholder_test.rb
stripe-5.22.0 test/stripe/issuing/cardholder_test.rb
stripe-5.21.0 test/stripe/issuing/cardholder_test.rb
stripe-5.20.0 test/stripe/issuing/cardholder_test.rb
stripe-5.19.0 test/stripe/issuing/cardholder_test.rb
stripe-5.18.0 test/stripe/issuing/cardholder_test.rb
stripe-5.17.0 test/stripe/issuing/cardholder_test.rb
stripe-5.16.0 test/stripe/issuing/cardholder_test.rb
stripe-5.15.0 test/stripe/issuing/cardholder_test.rb
stripe-5.14.0 test/stripe/issuing/cardholder_test.rb