Sha256: 59570e4ffc97f88b6a977144299a22cce1c44b73877c76d71b69aafcc8ba48f2

Contents?: true

Size: 853 Bytes

Versions: 1

Compression:

Stored size: 853 Bytes

Contents

require 'spec_helper'

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

  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) { base.project([ :id ]).rename(:id => :other_id)                }
  let(:object)   { klass.new(relation)                                           }

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

  it { should be_kind_of(Algebra::Projection) }

  its(:operand) { should eql(base.rename(:id => :other_id)) }

  its(:header) { should == [ [ :other_id, Integer ] ] }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/optimizer/algebra/rename/projection_operand/optimize_spec.rb