Sha256: b6506443b0de731caa8f88e584c07ac3671b4389e86109e1a8c35955fffd0dd4

Contents?: true

Size: 633 Bytes

Versions: 2

Compression:

Stored size: 633 Bytes

Contents

require 'spec_helper'

describe DataMapper::ChunkedQuery do
  subject { TestModel }

  it "should allow chunked queries directly from Models" do
    subject.chunks(1).length.should == 100
  end

  it "should allow chunked queries from other queries" do
    subject.all(:number.lte => 50).chunks(1).length.should == 50
  end

  it "should allow iterating over every resource" do
    count = 0

    subject.each_chunk(2) { |chunk| count += chunk.length }

    count.should == 100
  end

  it "should allow processing records in batch" do
    count = 0

    subject.batch(2) { |resource| count += 1 }

    count.should == 100
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dm-chunked_query-0.3.1 spec/chunked_query_spec.rb
dm-chunked_query-0.3.0 spec/chunked_query_spec.rb