Sha256: 92c958a2d9ba99ebc02a8b8260e0fd8c0adfe8e9c2e4518416a8d9333a8ad651
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
require 'spec_helper' describe 'Veritas::Relation::Operation::Offset.new' do subject { object.new(relation, offset) } let(:original_relation) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]) } let(:object) { Relation::Operation::Offset } context 'with an ordered relation' do let(:relation) { original_relation.order { |r| r[:id] } } let(:offset) { 1 } it { should be_kind_of(object) } end context 'with an ordered relation having an empty header' do let(:relation) { original_relation.order { |r| r[:id] }.project([]) } let(:offset) { 1 } it { should be_kind_of(object) } end context 'without an ordered relation' do let(:relation) { original_relation } let(:offset) { 1 } specify { expect { subject }.to raise_error(OrderedRelationRequiredError, 'can only offset an ordered operand') } end context 'with an offset less than 0' do let(:relation) { original_relation.order { |r| r[:id] } } let(:offset) { -1 } specify { expect { subject }.to raise_error(InvalidOffsetError, 'offset must be greater than or equal to 0, but was -1') } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
veritas-0.0.2 | spec/unit/veritas/relation/operation/offset/class_methods/new_spec.rb |