Sha256: 6c0475a5f7d9fad0dc554050685972be55d147b0c186e2ce59f2b60c47956594

Contents?: true

Size: 1.75 KB

Versions: 55

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(make_response(make_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(make_response(make_application_fee), make_response(make_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(make_response(make_application_fee))
      @mock.expects(:post).once.returns(make_response(make_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(make_response(make_application_fee))
      @mock.expects(:post).once.returns(make_response(make_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

55 entries across 55 versions & 1 rubygems

Version Path
stripe-1.58.0 test/stripe/application_fee_refund_test.rb
stripe-1.57.1 test/stripe/application_fee_refund_test.rb
stripe-1.57.0 test/stripe/application_fee_refund_test.rb
stripe-1.56.2 test/stripe/application_fee_refund_test.rb
stripe-1.56.1 test/stripe/application_fee_refund_test.rb
stripe-1.56.0 test/stripe/application_fee_refund_test.rb
stripe-1.55.1 test/stripe/application_fee_refund_test.rb
stripe-1.55.0 test/stripe/application_fee_refund_test.rb
stripe-1.54.0 test/stripe/application_fee_refund_test.rb
stripe-1.53.0 test/stripe/application_fee_refund_test.rb
stripe-1.52.0 test/stripe/application_fee_refund_test.rb
stripe-1.51.1 test/stripe/application_fee_refund_test.rb
stripe-1.51.0 test/stripe/application_fee_refund_test.rb
stripe-1.50.1 test/stripe/application_fee_refund_test.rb
stripe-1.50.0 test/stripe/application_fee_refund_test.rb
stripe-1.49.0 test/stripe/application_fee_refund_test.rb
stripe-1.48.0 test/stripe/application_fee_refund_test.rb
stripe-1.47.0 test/stripe/application_fee_refund_test.rb
stripe-1.46.0 test/stripe/application_fee_refund_test.rb
stripe-1.45.0 test/stripe/application_fee_refund_test.rb