Sha256: 61f06a667b4f48f14e98259566d403e339ff36839ae8ddfb1d42ea1bbbf6d46a
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Relation::Operation::Limit::Methods, '#first' do let(:described_class) { Relation } let(:relation) { described_class.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ].each) } let(:object) { relation.order } context 'with no arguments' do subject { object.first } it { should be_kind_of(Relation::Operation::Limit) } its(:limit) { should == 1 } it 'returns the expected tuples' do should == [ [ 1 ] ] end it 'behaves similar to Array#first' do should == [ object.to_a.first ] end end context 'with a limit' do subject { object.first(limit) } let(:limit) { 2 } it { should be_kind_of(Relation::Operation::Limit) } its(:limit) { should == limit } it 'returns the expected tuples' do should == [ [ 1 ], [ 2 ] ] end it 'behaves the same as Array#first' do should == object.to_a.first(limit) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
veritas-0.0.4 | spec/unit/veritas/relation/operation/limit/methods/first_spec.rb |