Sha256: 37bc792225d02045fc7e9c1302ad5edf176d9af9a9f6361683ee7306d8fe4790
Contents?: true
Size: 997 Bytes
Versions: 1
Compression:
Stored size: 997 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe Optimizer::Relation::Operation::Limit::LimitOperand, '#optimize' do subject { object.optimize } let(:sorted) { Relation.new([[:id, Integer]], LazyEnumerable.new([[1]])).sort_by { |r| r.id } } let(:limit) { sorted.take(2) } let(:object) { described_class.new(relation) } before do expect(object).to be_optimizable end context 'when the operand has a larger limit than the operation' do let(:relation) { limit.take(1) } it { should be_kind_of(Relation::Operation::Limit) } its(:operand) { should be(sorted) } its(:limit) { should == 1 } end context 'when the operand has a smaller limit than the operation' do let(:relation) { limit.take(3) } it { should be_kind_of(Relation::Operation::Limit) } its(:operand) { should be(sorted) } its(:limit) { should == 2 } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-optimizer-0.2.0 | spec/unit/axiom/optimizer/relation/operation/limit/limit_operand/optimize_spec.rb |