Sha256: 96d5f2f5998831c1146ab4c06c69d91ac8e396c4f2adfb67e6fe9bc9cff909e7

Contents?: true

Size: 692 Bytes

Versions: 1

Compression:

Stored size: 692 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

  before do
    expect(object).to 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
axiom-optimizer-0.1.1 spec/unit/axiom/optimizer/algebra/rename/limit_operand/optimize_spec.rb