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.41.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.40.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.39.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.38.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.37.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.36.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.35.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.34.1 spec/unit/braintree/resource_collection_spec.rb
braintree-2.34.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.33.1 spec/unit/braintree/resource_collection_spec.rb
braintree-2.33.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.32.1 spec/unit/braintree/resource_collection_spec.rb
braintree-2.31.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.30.2 spec/unit/braintree/resource_collection_spec.rb
braintree-2.30.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.29.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.28.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.27.1 spec/unit/braintree/resource_collection_spec.rb
braintree-2.27.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.26.0 spec/unit/braintree/resource_collection_spec.rb