Sha256: a7fbdb683af2e0fc40e9f55454855614f6fde10b7fbe5ead49829591a6b00ffb

Contents?: true

Size: 876 Bytes

Versions: 2

Compression:

Stored size: 876 Bytes

Contents

require 'spec_helper'

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

  let(:klass)    { Optimizer::Algebra::Rename::ProjectionOperand                 }
  let(:header)   { Relation::Header.new([ [ :id, Integer ], [ :name, String ] ]) }
  let(:base)     { Relation.new(header, [ [ 1, 'Dan Kubb' ] ].each)              }
  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 projection' do
    let(:operand) { base.project([ :id ]) }

    it { should be(true) }
  end

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