Sha256: be1217212e49c08aabcb1778a5889796d85b45bd8ba0672d6de680ffdb32ca10

Contents?: true

Size: 1.31 KB

Versions: 10

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

10 entries across 10 versions & 1 rubygems

Version Path
stripe-3.23.0 test/stripe/reversal_test.rb
stripe-3.22.0 test/stripe/reversal_test.rb
stripe-3.21.0 test/stripe/reversal_test.rb
stripe-3.20.0 test/stripe/reversal_test.rb
stripe-3.19.0 test/stripe/reversal_test.rb
stripe-3.18.0 test/stripe/reversal_test.rb
stripe-3.17.2 test/stripe/reversal_test.rb
stripe-3.17.1 test/stripe/reversal_test.rb
stripe-3.17.0 test/stripe/reversal_test.rb
stripe-3.15.0 test/stripe/reversal_test.rb