mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-05 00:02:50 -04:00
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.
25 lines
641 B
Ruby
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
|