Unit tests for ApplicationFee.

This commit is contained in:
Amber Feng 2013-11-14 12:25:13 -08:00
parent 81e46f4d6c
commit 127e906d60
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,22 @@
require File.expand_path('../../test_helper', __FILE__)
module Stripe
class ApplicationFeeTest < Test::Unit::TestCase
should "application fees should be listable" do
@mock.expects(:get).once.returns(test_response(test_application_fee_array))
fees = Stripe::ApplicationFee.all
assert fees.data.kind_of? Array
fees.each do |fee|
assert fee.kind_of?(Stripe::ApplicationFee)
end
end
should "application fees should be refundable" do
@mock.expects(:get).never
@mock.expects(:post).once.returns(test_response({:id => "fee_test_fee", :refunded => true}))
fee = Stripe::ApplicationFee.new("test_application_fee")
fee.refund
assert fee.refunded
end
end
end

View File

@ -70,6 +70,29 @@ def test_balance_transaction_array
}
end
def test_application_fee(params={})
{
:refunded => false,
:amount => 100,
:application => "ca_test_application",
:user => "acct_test_user",
:charge => "ch_test_charge",
:id => "fee_test_fee",
:livemode => false,
:currency => "usd",
:object => "application_fee",
:created => 1304114826
}.merge(params)
end
def test_application_fee_array
{
:data => [test_application_fee, test_application_fee, test_application_fee],
:object => 'list',
:url => '/v1/application_fees'
}
end
def test_customer(params={})
{
:subscription_history => [],