Sha256: 37791a3e98ceb572262145f0a05b550ddce298aff43a8fcf9a928af73307e58d

Contents?: true

Size: 1.32 KB

Versions: 20

Compression:

Stored size: 1.32 KB

Contents

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

module Stripe
  class ReversalTest < Test::Unit::TestCase
    FIXTURE = API_FIXTURES.fetch(:transfer_reversal)

    setup do
      @transfer = Stripe::Transfer.retrieve(API_FIXTURES.fetch(:transfer)[:id])
    end

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

    should "be retrievable" do
      reversal = @transfer.reversals.retrieve(FIXTURE[:id])
      assert_requested :get,
        "#{Stripe.api_base}/v1/transfers/#{@transfer.id}/reversals/#{FIXTURE[:id]}"
      assert reversal.kind_of?(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.kind_of?(Stripe::Reversal)
    end

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
stripe-3.0.3 test/stripe/reversal_test.rb
stripe-3.0.1 test/stripe/reversal_test.rb
stripe-3.0.0 test/stripe/reversal_test.rb
stripe-2.12.0 test/stripe/reversal_test.rb
stripe-2.11.0 test/stripe/reversal_test.rb
stripe-2.10.0 test/stripe/reversal_test.rb
stripe-2.9.0 test/stripe/reversal_test.rb
stripe-2.8.0 test/stripe/reversal_test.rb
stripe-2.7.0 test/stripe/reversal_test.rb
stripe-2.6.0 test/stripe/reversal_test.rb
stripe-2.5.0 test/stripe/reversal_test.rb
stripe-2.4.0 test/stripe/reversal_test.rb
stripe-2.3.0 test/stripe/reversal_test.rb
stripe-2.2.1 test/stripe/reversal_test.rb
stripe-2.2.0 test/stripe/reversal_test.rb
stripe-2.1.0 test/stripe/reversal_test.rb
stripe-2.0.3 test/stripe/reversal_test.rb
stripe-2.0.2 test/stripe/reversal_test.rb
stripe-2.0.1 test/stripe/reversal_test.rb
stripe-2.0.0 test/stripe/reversal_test.rb