Sha256: ddc0cda77b3fc46076379927d37eaea71ec49dc180a45105e693a3be152ee551

Contents?: true

Size: 584 Bytes

Versions: 69

Compression:

Stored size: 584 Bytes

Contents

require File.expand_path(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

69 entries across 69 versions & 1 rubygems

Version Path
braintree-2.25.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.24.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.23.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.22.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.21.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.20.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.19.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.18.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.17.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.16.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.15.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.14.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.13.4 spec/unit/braintree/resource_collection_spec.rb
braintree-2.13.3 spec/unit/braintree/resource_collection_spec.rb
braintree-2.13.2 spec/unit/braintree/resource_collection_spec.rb
braintree-2.13.1 spec/unit/braintree/resource_collection_spec.rb
braintree-2.10.3 spec/unit/braintree/resource_collection_spec.rb
braintree-2.13.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.12.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.11.0 spec/unit/braintree/resource_collection_spec.rb