Sha256: 23f8921060b5fd7695675e81ca02f92926fab1c7e6e714d0308791fc3ecd5a4d

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Algebra::Rename::LimitOperand, '#optimize' do
  subject { object.optimize }

  let(:header)   { Relation::Header.new([ [ :id, Integer ] ]) }
  let(:base)     { Relation.new(header, [ [ 1 ] ].each)       }
  let(:order)    { base.order                                 }
  let(:relation) { order.take(2).rename(:id => :other_id)     }
  let(:object)   { described_class.new(relation)              }

  before do
    object.should be_optimizable
  end

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

  its(:operand) { should eql(order.rename(:id => :other_id)) }

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/algebra/rename/limit_operand/optimize_spec.rb