Sha256: 4ecd7d619455954e2ba4cdcaa3634c797177b164124839eb5389f74cb0769f86

Contents?: true

Size: 758 Bytes

Versions: 4

Compression:

Stored size: 758 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  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)    { described_class.new(relation)                        }

  before do
    object.should be_optimizable
  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

4 entries across 4 versions & 1 rubygems

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