Sha256: 1e5233c0b367197de344b8fd29eda968a59e4279eb78327efb1d0e70572fff76

Contents?: true

Size: 839 Bytes

Versions: 2

Compression:

Stored size: 839 Bytes

Contents

require 'spec_helper'

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

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

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

  before do
    right.stub!(:optimize).and_return(right)
  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

2 entries across 2 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/optimizer/relation/operation/binary/empty_left/optimizable_spec.rb
veritas-0.0.1 spec/unit/veritas/optimizer/relation/operation/binary/empty_left/optimizable_spec.rb