stripe-ruby/test/stripe/application_fee_test.rb
Brandur 42ea34b969 Pagination
Usage on a top-level collection:

```
Stripe::Customer.list.auto_paging_each do |customer|
  puts customer
end
```

Usage on a subcollection:

``` ruby
customer.invoices.auto_paging_each do |invoice|
  puts invoice
end
```

We've also renamed `#all` to `#list` to prevent confusion ("all" implies
that all resources are being returned, and in Stripe's paginated API
this was not the case). An alias has been provided for backward API
compatibility.

Fixes #167.

Replaces #211 and #248.
2015-10-05 12:15:09 -07:00

23 lines
739 B
Ruby

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(make_response(make_application_fee_array))
fees = Stripe::ApplicationFee.list
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(make_response({:id => "fee_test_fee", :refunded => true}))
fee = Stripe::ApplicationFee.new("test_application_fee")
fee.refund
assert fee.refunded
end
end
end