Sha256: 7be6f5340813f7ddfc25caec2f04f0d9213a905c0f064715a4694b647d6d57bc

Contents?: true

Size: 1.54 KB

Versions: 20

Compression:

Stored size: 1.54 KB

Contents

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

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
      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
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
stripe-3.14.0 test/stripe/recipient_test.rb
stripe-3.13.1 test/stripe/recipient_test.rb
stripe-3.13.0 test/stripe/recipient_test.rb
stripe-3.12.1 test/stripe/recipient_test.rb
stripe-3.12.0 test/stripe/recipient_test.rb
stripe-3.11.0 test/stripe/recipient_test.rb
stripe-3.10.0 test/stripe/recipient_test.rb
stripe-3.9.2 test/stripe/recipient_test.rb
stripe-3.9.1 test/stripe/recipient_test.rb
stripe-3.9.0 test/stripe/recipient_test.rb
stripe-3.8.2 test/stripe/recipient_test.rb
stripe-3.8.1 test/stripe/recipient_test.rb
stripe-3.8.0 test/stripe/recipient_test.rb
stripe-3.7.0 test/stripe/recipient_test.rb
stripe-3.6.0 test/stripe/recipient_test.rb
stripe-3.5.3 test/stripe/recipient_test.rb
stripe-3.5.2 test/stripe/recipient_test.rb
stripe-3.5.1 test/stripe/recipient_test.rb
stripe-3.5.0 test/stripe/recipient_test.rb
stripe-3.4.1 test/stripe/recipient_test.rb