Sha256: 9c4857a9680aa0a40f3e7344978ec343fd9edd8b7d4a0e539e3a5a2406d86a49

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Relation::Operation::Binary::UnoptimizedOperands, '#optimizable?' do
  subject { object.optimizable? }

  let(:optimized)   { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ]) }
  let(:unoptimized) { optimized.project(optimized.header)           }
  let(:relation)    { left.union(right)                             }
  let(:object)      { described_class.new(relation)                 }

  context 'when the left and right operands are optimized' do
    let(:left)  { optimized }
    let(:right) { optimized }

    it { should be(false) }
  end

  context 'when the left operand is not optimized and the right operand is optimized' do
    let(:left)  { unoptimized }
    let(:right) { optimized   }

    it { should be(true) }
  end

  context 'when the left operand is optimized and the right operand is not optimized' do
    let(:left)  { optimized   }
    let(:right) { unoptimized }

    it { should be(true) }
  end

  context 'when the left and right operands are not optimized' do
    let(:left)  { unoptimized }
    let(:right) { unoptimized }

    it { should be(true) }
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
axiom-optimizer-0.1.0 spec/unit/axiom/optimizer/relation/operation/binary/unoptimized_operands/optimizable_predicate_spec.rb
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/relation/operation/binary/unoptimized_operands/optimizable_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/relation/operation/binary/unoptimized_operands/optimizable_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/relation/operation/binary/unoptimized_operands/optimizable_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/relation/operation/binary/unoptimized_operands/optimizable_spec.rb