Sha256: 2012cad4ead0361123fb940ed39268cf7d245bf829a0edd36e7d4776a505920f

Contents?: true

Size: 767 Bytes

Versions: 2

Compression:

Stored size: 767 Bytes

Contents

require 'spec_helper'

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

  let(:klass)    { Optimizer::Algebra::Rename::ReverseOperand         }
  let(:base)     { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ].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 an reverse operation' do
    let(:operand) { base.order.take(2).reverse }

    it { should be(true) }
  end

  context 'when the operand is not an reverse operation' 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/reverse_operand/optimizable_spec.rb
veritas-0.0.1 spec/unit/veritas/optimizer/algebra/rename/reverse_operand/optimizable_spec.rb