Sha256: 3c5c3a8e280e8f19063fc6433a10de24ea5159092756e7db1b8f4f479ec71d9b
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Relation::Operation::Limit::Methods, '#last' do let(:described_class) { Relation } let(:relation) { described_class.new([ [ :id, Integer ] ], LazyEnumerable.new([ [ 1 ], [ 2 ], [ 3 ] ])) } let(:object) { relation.sort_by { |r| r.id } } context 'with no arguments' do subject { object.last } it { should be_instance_of(Relation::Operation::Reverse) } it 'returns the expected tuples' do should == [ [ 3 ] ] end it 'behaves similar to Array#last' do should == [ object.to_a.last ] end end context 'with a limit' do subject { object.last(limit) } let(:limit) { 2 } it { should be_instance_of(Relation::Operation::Reverse) } it 'returns the expected tuples' do should == [ [ 2 ], [ 3 ] ] end it 'behaves the same as Array#last' do should == object.to_a.last(limit) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.0 | spec/unit/axiom/relation/operation/limit/methods/last_spec.rb |