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.62.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.61.1 spec/unit/braintree/resource_collection_spec.rb
braintree-2.61.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.60.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.59.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.58.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.57.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.56.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.55.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.54.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.50.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.49.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.48.1 spec/unit/braintree/resource_collection_spec.rb
braintree-2.48.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.47.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.46.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.45.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.44.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.43.0 spec/unit/braintree/resource_collection_spec.rb
braintree-2.42.0 spec/unit/braintree/resource_collection_spec.rb