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

25 lines
641 B
Ruby

require File.expand_path('../../test_helper', __FILE__)
module Stripe
class SKUTest < Test::Unit::TestCase
should "SKUs should be listable" do
@mock.expects(:get).once.
returns(make_response(make_sku_array("test_product")))
skus = Stripe::SKU.list
assert skus.data.kind_of? Array
skus.each do |sku|
assert sku.kind_of?(Stripe::SKU)
end
end
should "SKUs should not be deletable" do
assert_raises NoMethodError do
@mock.expects(:get).once.returns(make_response(make_sku))
p = Stripe::SKU.retrieve("test_product")
p.delete
end
end
end
end