Sha256: 7161470aebe74e06a2cf7666ffd59c280b5dd4e29b9e4e42955ce11a22849865

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

require 'spec_helper'

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

  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)  { base.restrict(predicate).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::Restriction)
  end

  it { should be_kind_of(Algebra::Restriction) }

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

  its(:predicate) { should == header[:id].rename(:other_id).eq(1) }
end

Version data entries

1 entries across 1 versions & 1 rubygems

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