Sha256: d8d33ef6d4cd7068c04d90213db20bbecbb77213059b8fe5e8e0fb260b2027e0

Contents?: true

Size: 1.75 KB

Versions: 15

Compression:

Stored size: 1.75 KB

Contents

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

module Stripe
  class ApplicationFeeRefundTest < Test::Unit::TestCase
    should "refunds should be listable" do
      @mock.expects(:get).once.returns(test_response(test_application_fee))

      application_fee = Stripe::ApplicationFee.retrieve('test_application_fee')

      assert application_fee.refunds.first.kind_of?(Stripe::ApplicationFeeRefund)
    end

    should "refunds should be refreshable" do
      @mock.expects(:get).twice.returns(test_response(test_application_fee), test_response(test_application_fee_refund(:id => 'refreshed_refund')))

      application_fee = Stripe::ApplicationFee.retrieve('test_application_fee')
      refund = application_fee.refunds.first
      refund.refresh

      assert_equal 'refreshed_refund', refund.id
    end

    should "refunds should be updateable" do
      @mock.expects(:get).once.returns(test_response(test_application_fee))
      @mock.expects(:post).once.returns(test_response(test_application_fee_refund(:metadata => {'key' => 'value'})))

      application_fee = Stripe::ApplicationFee.retrieve('test_application_fee')
      refund = application_fee.refunds.first

      assert_equal nil, refund.metadata['key']

      refund.metadata['key'] = 'valu'
      refund.save

      assert_equal 'value', refund.metadata['key']
    end

    should "create should return a new refund" do
      @mock.expects(:get).once.returns(test_response(test_application_fee))
      @mock.expects(:post).once.returns(test_response(test_application_fee_refund(:id => 'test_new_refund')))

      application_fee = Stripe::ApplicationFee.retrieve('test_application_fee')
      refund = application_fee.refunds.create(:amount => 20)
      assert_equal 'test_new_refund', refund.id
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
stripe-1.22.0 test/stripe/application_fee_refund_test.rb
stripe-1.21.0 test/stripe/application_fee_refund_test.rb
stripe-1.20.4 test/stripe/application_fee_refund_test.rb
stripe-1.20.3 test/stripe/application_fee_refund_test.rb
stripe-1.20.2 test/stripe/application_fee_refund_test.rb
stripe-1.20.1 test/stripe/application_fee_refund_test.rb
stripe-1.20.0 test/stripe/application_fee_refund_test.rb
stripe-1.19.0 test/stripe/application_fee_refund_test.rb
stripe-1.18.0 test/stripe/application_fee_refund_test.rb
stripe-1.17.3 test/stripe/application_fee_refund_test.rb
stripe-1.17.2 test/stripe/application_fee_refund_test.rb
stripe-1.17.1 test/stripe/application_fee_refund_test.rb
stripe-1.16.1 test/stripe/application_fee_refund_test.rb
stripe-1.16.0 test/stripe/application_fee_refund_test.rb
stripe-1.15.0 test/stripe/application_fee_refund_test.rb