Sha256: 65a7bdb366fcb3119020dab85b0b3a7a5b8c0cbdd9ff71752b6e2f1d141e95d2

Contents?: true

Size: 1.48 KB

Versions: 15

Compression:

Stored size: 1.48 KB

Contents

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

module Stripe
  class PayoutTest < Test::Unit::TestCase
    FIXTURE = API_FIXTURES.fetch(:payout)

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

    should "be retrievable" do
      payout = Stripe::Payout.retrieve(FIXTURE[:id])
      assert_requested :get, "#{Stripe.api_base}/v1/payouts/#{FIXTURE[:id]}"
      assert payout.kind_of?(Stripe::Payout)
    end

    should "be creatable" do
      payout = Stripe::Payout.create(
        amount: 100,
        currency: "USD"
      )
      assert_requested :post, "#{Stripe.api_base}/v1/payouts"
      assert payout.kind_of?(Stripe::Payout)
    end

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

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

    context "#cancel" do
      should "cancel a payout" do
        payout = Stripe::Payout.retrieve(FIXTURE[:id])
        payout = payout.cancel
        assert payout.kind_of?(Stripe::Payout)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
stripe-3.0.3 test/stripe/payout_test.rb
stripe-3.0.1 test/stripe/payout_test.rb
stripe-3.0.0 test/stripe/payout_test.rb
stripe-2.12.0 test/stripe/payout_test.rb
stripe-2.11.0 test/stripe/payout_test.rb
stripe-2.10.0 test/stripe/payout_test.rb
stripe-2.9.0 test/stripe/payout_test.rb
stripe-2.8.0 test/stripe/payout_test.rb
stripe-2.7.0 test/stripe/payout_test.rb
stripe-2.6.0 test/stripe/payout_test.rb
stripe-2.5.0 test/stripe/payout_test.rb
stripe-2.4.0 test/stripe/payout_test.rb
stripe-2.3.0 test/stripe/payout_test.rb
stripe-2.2.1 test/stripe/payout_test.rb
stripe-2.2.0 test/stripe/payout_test.rb