diff options
Diffstat (limited to 'spec/engines/memory/unit/relations/take_spec.rb')
-rw-r--r-- | spec/engines/memory/unit/relations/take_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/engines/memory/unit/relations/take_spec.rb b/spec/engines/memory/unit/relations/take_spec.rb new file mode 100644 index 0000000000..16b99872c5 --- /dev/null +++ b/spec/engines/memory/unit/relations/take_spec.rb @@ -0,0 +1,26 @@ +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) \ + .let do |relation| + relation.call.should == [ + Row.new(relation, [1, 'duck']), + Row.new(relation, [2, 'duck']), + ] + end + end + end + end +end |