Sha256: 49cab4a91cd6644550792e31548eceed2a659aace208af0d66e2569a153f3996

Contents?: true

Size: 758 Bytes

Versions: 2

Compression:

Stored size: 758 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:base)     { Relation.new([[:id, Integer]], LazyEnumerable.new([[1]])).sort_by { |r| r.id } }
  let(:relation) { base.take(limit)                                                               }
  let(:object)   { described_class.new(relation)                                                  }

  before do
    expect(object.operation).to be_kind_of(Relation::Operation::Limit)
  end

  context 'when the operation limit is 0' do
    let(:limit) { 0 }

    it { should be(true) }
  end

  context 'when the operation limit is not 0' do
    let(:limit) { 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/limit/zero_limit/optimizable_predicate_spec.rb
axiom-optimizer-0.1.1 spec/unit/axiom/optimizer/relation/operation/limit/zero_limit/optimizable_predicate_spec.rb