Sha256: c18596293a4a2d86636fc7ef42fb21f5bf7ff4a9c2fc7cf1e57c3753d5b59724

Contents?: true

Size: 1.9 KB

Versions: 52

Compression:

Stored size: 1.9 KB

Contents

# frozen_string_literal: true

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

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

    should "be retrievable" do
      recipient = Stripe::Recipient.retrieve("rp_123")
      assert_requested :get, "#{Stripe.api_base}/v1/recipients/rp_123"
      assert recipient.is_a?(Stripe::Recipient)
    end

    should "be creatable" do
      recipient = Stripe::Recipient.create(
        name: "Noah Jackson",
        type: "individual"
      )
      assert_requested :post, "#{Stripe.api_base}/v1/recipients"
      assert recipient.is_a?(Stripe::Recipient)
    end

    should "be saveable" do
      recipient = Stripe::Recipient.retrieve("rp_123")
      recipient.metadata["key"] = "value"
      recipient.save
      assert_requested :post, "#{Stripe.api_base}/v1/recipients/#{recipient.id}"
    end

    should "be updateable" do
      recipient = Stripe::Recipient.update("rp_123", metadata: { foo: "bar" })
      assert_requested :post, "#{Stripe.api_base}/v1/recipients/rp_123"
      assert recipient.is_a?(Stripe::Recipient)
    end

    should "be deletable" do
    end

    context "#delete" do
      should "be deletable" do
        recipient = Stripe::Recipient.retrieve("rp_123")
        recipient = recipient.delete
        assert_requested :delete, "#{Stripe.api_base}/v1/recipients/#{recipient.id}"
        assert recipient.is_a?(Stripe::Recipient)
      end
    end

    context ".delete" do
      should "be deletable" do
        recipient = Stripe::Recipient.delete("rp_123")
        assert_requested :delete, "#{Stripe.api_base}/v1/recipients/rp_123"
        assert recipient.is_a?(Stripe::Recipient)
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

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