Sha256: 3fde2f1e95b895b999cb69a36184cf059fbe0c9d4f96939fdbe8c1c9fe640bc7

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

Stored size: 828 Bytes

Contents

require 'spec_helper'

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

  let(:klass)    { Optimizer::Algebra::Rename::OffsetOperand          }
  let(:base)     { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ].each) }
  let(:aliases)  { { :id => :other_id }                               }
  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 an offset operation' do
    let(:operand) { base.order.drop(1) }

    it { should be(true) }
  end

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