Sha256: 7174899eb3dcfb039d6ef2c2fd3843539a42ea93a02eac9414802d59f1c82c80

Contents?: true

Size: 638 Bytes

Versions: 3

Compression:

Stored size: 638 Bytes

Contents

require 'spec_helper'

module Arel
  describe Take do
    before do
      @relation = Array.new([
        [1, 'duck' ],
        [2, 'duck' ],
        [3, 'goose']
      ], [[:id, Attributes::Integer], [:name, Attributes::String]])
    end

    describe '#call' do
      it 'removes the rows after the first n' do
        @relation   \
          .take(2)  \
        .tap do |relation|
          rows = relation.call
          rows.length.should == 2
          rows.each_with_index do |row, i|
            row.relation.should == relation
            row.tuple.should == [i + 1, 'duck']
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arel-1.0.1 spec/engines/memory/unit/relations/take_spec.rb
arel-1.0.0 spec/engines/memory/unit/relations/take_spec.rb
arel-1.0.0.rc1 spec/engines/memory/unit/relations/take_spec.rb