Sha256: 4896808e157324401c2c49b9a8094369800de3ee44882d83ab865c1583c4b12f

Contents?: true

Size: 851 Bytes

Versions: 2

Compression:

Stored size: 851 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Algebra::Restriction::RestrictionOperand, '#optimize' do
  subject { object.optimize }

  let(:header)          { Relation::Header.coerce([[:id, Integer]])                }
  let(:base)            { Relation.new(header, LazyEnumerable.new([[1]]))          }
  let(:predicate)       { header[:id].eq(1)                                        }
  let(:other_predicate) { header[:id].include([1])                                 }
  let(:relation)        { base.restrict { predicate }.restrict { other_predicate } }
  let(:object)          { described_class.new(relation)                            }

  before do
    expect(object).to be_optimizable
  end

  it { should be_kind_of(Algebra::Restriction) }

  its(:operand) { should be(base) }

  its(:predicate) { should be(predicate) }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 spec/unit/axiom/optimizer/algebra/restriction/restriction_operand/optimize_spec.rb
axiom-optimizer-0.1.1 spec/unit/axiom/optimizer/algebra/restriction/restriction_operand/optimize_spec.rb