Sha256: 5b7f771e0c53941afba7f2e8c5504ffc64a22b9496fc4ebe38beedea394b3c23

Contents?: true

Size: 991 Bytes

Versions: 1

Compression:

Stored size: 991 Bytes

Contents

require 'spec_helper'

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

  let(:klass)    { Optimizer::Algebra::Rename::RenameOperand                     }
  let(:header)   { Relation::Header.new([ [ :id, Integer ], [ :name, String ] ]) }
  let(:base)     { Relation.new(header, [ [ 1, 'Dan Kubb' ] ].each)              }
  let(:relation) { operand.rename(aliases)                                       }
  let(:object)   { klass.new(relation)                                           }

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

  context 'when the operand is a rename' do
    let(:aliases) { { :id => :other_id }              }
    let(:operand) { base.rename(:name => :other_name) }

    it { should be(true) }
  end

  context 'when the operand is not a rename' do
    let(:aliases) { { :id => :other_id } }
    let(:operand) { base                 }

    it { should be(false) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/optimizer/algebra/rename/rename_operand/optimizable_spec.rb