Sha256: 9db5ac376c44c408144cae0ac675b685eb28d480f215956d84a72e766c418d61

Contents?: true

Size: 832 Bytes

Versions: 2

Compression:

Stored size: 832 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Optimizer::Algebra::Restriction::OrderOperand#optimizable?' do
  subject { object.optimizable? }

  let(:klass)     { Optimizer::Algebra::Restriction::OrderOperand      }
  let(:base)      { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ].each) }
  let(:predicate) { base[:id].eq(1)                                    }
  let(:relation)  { operand.restrict(predicate)                        }
  let(:object)    { klass.new(relation)                                }

  before do
    object.operation.should be_kind_of(Algebra::Restriction)
  end

  context 'when the operand is an order operation' do
    let(:operand) { base.order }

    it { should be(true) }
  end

  context 'when the operand is not an order operation' 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/algebra/restriction/order_operand/optimizable_spec.rb
veritas-0.0.1 spec/unit/veritas/optimizer/algebra/restriction/order_operand/optimizable_spec.rb