Sha256: bfe76f220a7fe9446ab8cadc4afdff632867538307cafcfaefbf1c571c77ed47

Contents?: true

Size: 876 Bytes

Versions: 2

Compression:

Stored size: 876 Bytes

Contents

require 'spec_helper'

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

  let(:klass)     { Optimizer::Algebra::Restriction::ReverseOperand          }
  let(:base)      { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ].each).order }
  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 a reverse operation' do
    let(:operand) { base.take(2).reverse }

    it { should be(true) }
  end

  context 'when the operand is not a reverse 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/reverse_operand/optimizable_spec.rb
veritas-0.0.1 spec/unit/veritas/optimizer/algebra/restriction/reverse_operand/optimizable_spec.rb