Sha256: abc6545334297185c701fe5f1205b381fb4d4eb7a294c1bd844d54ed56d91125

Contents?: true

Size: 1.42 KB

Versions: 29

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

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

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

    should "be retrievable" do
      payout = Stripe::Payout.retrieve("tr_123")
      assert_requested :get, "#{Stripe.api_base}/v1/payouts/tr_123"
      assert payout.is_a?(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.is_a?(Stripe::Payout)
    end

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

    should "be updateable" do
      payout = Stripe::Payout.update("tr_123", metadata: { foo: "bar" })
      assert_requested :post, "#{Stripe.api_base}/v1/payouts/tr_123"
      assert payout.is_a?(Stripe::Payout)
    end

    context "#cancel" do
      should "cancel a payout" do
        payout = Stripe::Payout.retrieve("tr_123")
        payout = payout.cancel
        assert payout.is_a?(Stripe::Payout)
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
stripe-4.11.0 test/stripe/payout_test.rb
stripe-4.10.0 test/stripe/payout_test.rb
stripe-4.9.1 test/stripe/payout_test.rb
stripe-4.9.0 test/stripe/payout_test.rb
stripe-4.8.1 test/stripe/payout_test.rb
stripe-4.8.0 test/stripe/payout_test.rb
stripe-4.7.1 test/stripe/payout_test.rb
stripe-4.7.0 test/stripe/payout_test.rb
stripe-4.6.0 test/stripe/payout_test.rb
stripe-4.5.0 test/stripe/payout_test.rb
stripe-4.4.1 test/stripe/payout_test.rb
stripe-4.4.0 test/stripe/payout_test.rb
stripe-4.3.0 test/stripe/payout_test.rb
stripe-4.2.0 test/stripe/payout_test.rb
stripe-4.1.0 test/stripe/payout_test.rb
stripe-4.0.3 test/stripe/payout_test.rb
stripe-4.0.2 test/stripe/payout_test.rb
stripe-4.0.1 test/stripe/payout_test.rb
stripe-4.0.0 test/stripe/payout_test.rb
stripe-3.31.1 test/stripe/payout_test.rb