Sha256: 2be878771c3b487f88aa9cdeb902b94cbf0014534d6a36cecb0c2742a30c7ef9

Contents?: true

Size: 752 Bytes

Versions: 1

Compression:

Stored size: 752 Bytes

Contents

require 'spec_helper'

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

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

  before do
    object.operation.should be_kind_of(Algebra::Rename)
    object.operand.should be_kind_of(Relation::Operation::Limit)
  end

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

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