Sha256: c5cca5c60094f1316f3d7fd322481a4c5759d44caf7a80e432f37ce5d989c3c1

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 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 ] ], [ [ 1 ] ].each)          }
  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

3 entries across 3 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/relation/operation/binary/materialized_operands/optimizable_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/relation/operation/binary/materialized_operands/optimizable_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/relation/operation/binary/materialized_operands/optimizable_spec.rb