Sha256: 93ecea98a13c1346ee946649bd04e70c73596fdde683ce1455b70e46f45adae3

Contents?: true

Size: 1.64 KB

Versions: 20

Compression:

Stored size: 1.64 KB

Contents

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

module Stripe
  class RecipientTest < Test::Unit::TestCase
    FIXTURE = API_FIXTURES.fetch(:transfer_recipient)

    should "be listable" do
      recipients = Stripe::Recipient.list
      assert_requested :get, "#{Stripe.api_base}/v1/recipients"
      assert recipients.data.kind_of?(Array)
      assert recipients.data[0].kind_of?(Stripe::Recipient)
    end

    should "be retrievable" do
      recipient = Stripe::Recipient.retrieve(FIXTURE[:id])
      assert_requested :get, "#{Stripe.api_base}/v1/recipients/#{FIXTURE[:id]}"
      assert recipient.kind_of?(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.kind_of?(Stripe::Recipient)
    end

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

    should "be updateable" do
      recipient = Stripe::Recipient.update(FIXTURE[:id], metadata: {foo: 'bar'})
      assert_requested :post, "#{Stripe.api_base}/v1/recipients/#{FIXTURE[:id]}"
      assert recipient.kind_of?(Stripe::Recipient)
    end

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
stripe-3.0.3 test/stripe/recipient_test.rb
stripe-3.0.1 test/stripe/recipient_test.rb
stripe-3.0.0 test/stripe/recipient_test.rb
stripe-2.12.0 test/stripe/recipient_test.rb
stripe-2.11.0 test/stripe/recipient_test.rb
stripe-2.10.0 test/stripe/recipient_test.rb
stripe-2.9.0 test/stripe/recipient_test.rb
stripe-2.8.0 test/stripe/recipient_test.rb
stripe-2.7.0 test/stripe/recipient_test.rb
stripe-2.6.0 test/stripe/recipient_test.rb
stripe-2.5.0 test/stripe/recipient_test.rb
stripe-2.4.0 test/stripe/recipient_test.rb
stripe-2.3.0 test/stripe/recipient_test.rb
stripe-2.2.1 test/stripe/recipient_test.rb
stripe-2.2.0 test/stripe/recipient_test.rb
stripe-2.1.0 test/stripe/recipient_test.rb
stripe-2.0.3 test/stripe/recipient_test.rb
stripe-2.0.2 test/stripe/recipient_test.rb
stripe-2.0.1 test/stripe/recipient_test.rb
stripe-2.0.0 test/stripe/recipient_test.rb