Sha256: 8fc268cbea7cda04cd24d19b88f1c340b148559aa3c38356ee21605d4f3e7736

Contents?: true

Size: 1.81 KB

Versions: 6

Compression:

Stored size: 1.81 KB

Contents

# frozen_string_literal: true

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

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

6 entries across 6 versions & 1 rubygems

Version Path
stripe-3.23.0 test/stripe/issuing/cardholder_test.rb
stripe-3.22.0 test/stripe/issuing/cardholder_test.rb
stripe-3.21.0 test/stripe/issuing/cardholder_test.rb
stripe-3.20.0 test/stripe/issuing/cardholder_test.rb
stripe-3.19.0 test/stripe/issuing/cardholder_test.rb
stripe-3.18.0 test/stripe/issuing/cardholder_test.rb