Sha256: 32426947a1ec4cd32d1b9f7e3637dd81f7ab958b94895ec65d13fae649ec9ddb

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:materialized)     { Relation::Materialized.new([[:id, Integer]], [[1]])       }
  let(:not_materialized) { Relation.new([[:id, Integer]], LazyEnumerable.new([[1]])) }
  let(:left)             { not_materialized                                          }
  let(:right)            { not_materialized                                          }
  let(:relation)         { left.union(right)                                         }
  let(:object)           { described_class.new(relation)                             }

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

    it { should be(true) }
  end

  context 'when the left is materialized' do
    let(:left) { materialized }

    it { should be(false) }
  end

  context 'when the right is materialized' do
    let(:right) { materialized }

    it { should be(false) }
  end

  context 'when the left and right are not materialized' do
    it { should be(false) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 spec/unit/axiom/optimizer/relation/operation/binary/materialized_operands/optimizable_predicate_spec.rb
axiom-optimizer-0.1.1 spec/unit/axiom/optimizer/relation/operation/binary/materialized_operands/optimizable_predicate_spec.rb