stripe-ruby/test/stripe/bitcoin_transaction_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

30 lines
1.0 KiB
Ruby

require File.expand_path('../../test_helper', __FILE__)
module Stripe
class BitcoinTransactionTest < Test::Unit::TestCase
TEST_ID = "btctxn_test_transaction".freeze
should "retrieve should retrieve bitcoin receiver" do
@mock.expects(:get).
with("#{Stripe.api_base}/v1/bitcoin/transactions/#{TEST_ID}", nil, nil).
once.
returns(make_response(make_bitcoin_transaction))
receiver = Stripe::BitcoinTransaction.retrieve(TEST_ID)
assert_equal TEST_ID, receiver.id
end
should "all should list bitcoin transactions" do
@mock.expects(:get).
with("#{Stripe.api_base}/v1/bitcoin/transactions", nil, nil).
once.
returns(make_response(make_bitcoin_transaction_array))
transactions = Stripe::BitcoinTransaction.list
assert_equal 3, transactions.data.length
assert transactions.data.kind_of? Array
transactions.each do |transaction|
assert transaction.kind_of?(Stripe::BitcoinTransaction)
end
end
end
end