Sha256: 768ec0d6dae542365dab775e535694909806047d8f8170184d9ee53ee10cf758

Contents?: true

Size: 656 Bytes

Versions: 3

Compression:

Stored size: 656 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Relation::Operation::Limit::UnoptimizedOperand, '#optimize' do
  subject { object.optimize }

  let(:header)   { Relation::Header.new([ [ :id, Integer ] ])                }
  let(:order)    { Relation.new(header, [ [ 1 ] ].each).sort_by { |r| r.id } }
  let(:relation) { order.rename({}).take(1)                                  }
  let(:object)   { described_class.new(relation)                             }

  before do
    object.should be_optimizable
  end

  it { should be_kind_of(Relation::Operation::Limit) }

  its(:operand) { should equal(order) }

  its(:limit) { should == 1 }
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/relation/operation/limit/unoptimized_operand/optimize_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/relation/operation/limit/unoptimized_operand/optimize_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/relation/operation/limit/unoptimized_operand/optimize_spec.rb