Sha256: 874892ca57431521dfbf54fd3117e49b444e0866456e78e8f4a135095a420b23

Contents?: true

Size: 906 Bytes

Versions: 2

Compression:

Stored size: 906 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Optimizer::Relation::Operation::Order::OneLimitOperand#optimizable?' do
  subject { object.optimizable? }

  let(:klass)    { Optimizer::Relation::Operation::Order::OneLimitOperand }
  let(:base)     { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ].each)     }
  let(:relation) { operand.order                                          }
  let(:object)   { klass.new(relation)                                    }

  before do
    object.operation.should be_kind_of(Relation::Operation::Order)
  end

  context 'when the operand is limited to 1' do
    let(:operand) { base.order.take(1) }

    it { should be(true) }
  end

  context 'when the operand is not limited to 1' do
    let(:operand) { base.order.take(2) }

    it { should be(false) }
  end

  context 'when the operand is not limited' do
    let(:operand) { base }

    it { should be(false) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/optimizer/relation/operation/order/one_limit_operand/optimizable_spec.rb
veritas-0.0.1 spec/unit/veritas/optimizer/relation/operation/order/one_limit_operand/optimizable_spec.rb