Sha256: 1205a14d5c0fe972dbbcaa0557eeb30835f9c04df783bcd7acacd5689a6426bf

Contents?: true

Size: 807 Bytes

Versions: 4

Compression:

Stored size: 807 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  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)    { described_class.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

4 entries across 4 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/algebra/rename/restriction_operand/optimizable_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/algebra/rename/restriction_operand/optimizable_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/algebra/rename/restriction_operand/optimizable_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/algebra/rename/restriction_operand/optimizable_spec.rb