Sha256: 39ae89fb87e73dc9a5edc5ea9dafe12a216ecfe23925e010b2b55d6246edd5e3

Contents?: true

Size: 881 Bytes

Versions: 2

Compression:

Stored size: 881 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Optimizer::Algebra::Rename::RestrictionOperand#optimizable?' do
  subject { object.optimizable? }

  let(:klass)     { Optimizer::Algebra::Rename::RestrictionOperand }
  let(:header)    { Relation::Header.new([ [ :id, Integer ] ])     }
  let(:base)      { Relation.new(header, [ [ 1 ] ].each)           }
  let(:predicate) { base[:id].eq(1)                                }
  let(:relation)  { operand.rename(:id => :other_id)               }
  let(:object)    { klass.new(relation)                            }

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

  context 'when the operand is a restriction' do
    let(:operand) { base.restrict(predicate) }

    it { should be(true) }
  end

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