Sha256: 4cf8f4e62f6c69100e8773b2bce0fdc60d617119439eedf19296e7a12d518417

Contents?: true

Size: 813 Bytes

Versions: 2

Compression:

Stored size: 813 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)        { double('Relation', left: left, right: right)      }
  let(:right)           { double('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

2 entries across 2 versions & 1 rubygems

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