Sha256: 7153c918ae89dafe42a9d4144f9b0bc576189fe2d447a2367e1c85ae5a2caf97

Contents?: true

Size: 566 Bytes

Versions: 6

Compression:

Stored size: 566 Bytes

Contents

require File.dirname(__FILE__) + "/../spec_helper"

describe "Braintree::ResourceCollection" do
  describe "enumeration" do
    it "iterates over the elements, yielding to the block in pages" do
      values = %w(a b c d e)
      collection = Braintree::ResourceCollection.new(:search_results => {:ids => [0,1,2,3,4], :page_size => 2}) do |ids|
        ids.map {|id| values[id] }
      end

      count = 0
      collection.each_with_index do |item, index|
        item.should == values[index]
        count += 1
      end

      count.should == 5
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
braintree-2.6.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.5.2 spec/unit/braintree/resource_collection_spec.rb
braintree-2.5.1 spec/unit/braintree/resource_collection_spec.rb
braintree-2.4.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.3.1 spec/unit/braintree/resource_collection_spec.rb
braintree-2.2.0 spec/unit/braintree/resource_collection_spec.rb