Sha256: b439287a585a317337df4633ad687502359baa138409330b209956d279c39696

Contents?: true

Size: 825 Bytes

Versions: 5

Compression:

Stored size: 825 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:described_class) { Class.new(Optimizer::Relation::Operation::Binary) }
  let(:relation)        { mock('Relation', :left => left, :right => right)  }
  let(:right)           { mock('Right')                                     }
  let(:object)          { described_class.new(relation)                     }

  before do
    described_class.class_eval { include superclass::EmptyLeft }
  end

  context 'when left is empty' do
    let(:left) { Relation::Empty.new([ [ :id, Integer ] ]) }

    it { should be(true) }
  end

  context 'when left is not empty' do
    let(:left) { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ]) }

    it { should be(false) }
  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/empty_left/optimizable_predicate_spec.rb
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/relation/operation/binary/empty_left/optimizable_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/relation/operation/binary/empty_left/optimizable_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/relation/operation/binary/empty_left/optimizable_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/relation/operation/binary/empty_left/optimizable_spec.rb