Sha256: bb84be6a918cb53854a20c4078171e5e43cf9428e94604ef3d37e401855db313

Contents?: true

Size: 1.31 KB

Versions: 36

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

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

module Stripe
  class ReversalTest < Test::Unit::TestCase
    setup do
      @transfer = Stripe::Transfer.retrieve("tr_123")
    end

    should "be listable" do
      reversals = @transfer.reversals.list
      assert_requested :get,
                       "#{Stripe.api_base}/v1/transfers/#{@transfer.id}/reversals"
      assert reversals.data.is_a?(Array)
      assert reversals.data[0].is_a?(Stripe::Reversal)
    end

    should "be retrievable" do
      reversal = @transfer.reversals.retrieve("trr_123")
      assert_requested :get,
                       "#{Stripe.api_base}/v1/transfers/#{@transfer.id}/reversals/trr_123"
      assert reversal.is_a?(Stripe::Reversal)
    end

    should "be creatable" do
      reversal = @transfer.reversals.create(
        amount: 100
      )
      assert_requested :post,
                       "#{Stripe.api_base}/v1/transfers/#{@transfer.id}/reversals"
      assert reversal.is_a?(Stripe::Reversal)
    end

    should "be saveable" do
      reversal = @transfer.reversals.retrieve("trr_123")
      reversal.metadata["key"] = "value"
      reversal.save
      assert_requested :post,
                       "#{Stripe.api_base}/v1/transfers/#{reversal.transfer}/reversals/#{reversal.id}"
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
stripe-4.2.0 test/stripe/reversal_test.rb
stripe-4.1.0 test/stripe/reversal_test.rb
stripe-4.0.3 test/stripe/reversal_test.rb
stripe-4.0.2 test/stripe/reversal_test.rb
stripe-4.0.1 test/stripe/reversal_test.rb
stripe-4.0.0 test/stripe/reversal_test.rb
stripe-3.31.1 test/stripe/reversal_test.rb
stripe-3.31.0 test/stripe/reversal_test.rb
stripe-3.30.0 test/stripe/reversal_test.rb
stripe-3.29.0 test/stripe/reversal_test.rb
stripe-3.28.0 test/stripe/reversal_test.rb
stripe-3.27.0 test/stripe/reversal_test.rb
stripe-3.26.1 test/stripe/reversal_test.rb
stripe-3.26.0 test/stripe/reversal_test.rb
stripe-3.25.0 test/stripe/reversal_test.rb
stripe-3.24.0 test/stripe/reversal_test.rb