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.18.0 test/stripe/reversal_test.rb
stripe-4.17.0 test/stripe/reversal_test.rb
stripe-4.16.0 test/stripe/reversal_test.rb
stripe-4.15.0 test/stripe/reversal_test.rb
stripe-4.14.0 test/stripe/reversal_test.rb
stripe-4.13.0 test/stripe/reversal_test.rb
stripe-4.12.0 test/stripe/reversal_test.rb
stripe-4.11.0 test/stripe/reversal_test.rb
stripe-4.10.0 test/stripe/reversal_test.rb
stripe-4.9.1 test/stripe/reversal_test.rb
stripe-4.9.0 test/stripe/reversal_test.rb
stripe-4.8.1 test/stripe/reversal_test.rb
stripe-4.8.0 test/stripe/reversal_test.rb
stripe-4.7.1 test/stripe/reversal_test.rb
stripe-4.7.0 test/stripe/reversal_test.rb
stripe-4.6.0 test/stripe/reversal_test.rb
stripe-4.5.0 test/stripe/reversal_test.rb
stripe-4.4.1 test/stripe/reversal_test.rb
stripe-4.4.0 test/stripe/reversal_test.rb
stripe-4.3.0 test/stripe/reversal_test.rb