Sha256: 3ee5a972dd8b6dbe55d4ce58a057450f5ce7b29e9aa29ee849b17530868602c1

Contents?: true

Size: 696 Bytes

Versions: 1

Compression:

Stored size: 696 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:header)   { Relation::Header.coerce([[:id, Integer]])       }
  let(:base)     { Relation.new(header, LazyEnumerable.new([[1]])) }
  let(:sorted)   { base.sort_by { |r| r.id }                       }
  let(:relation) { sorted.drop(1).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::Offset) }

  its(:operand) { should eql(sorted.rename(id: :other_id)) }

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 spec/unit/axiom/optimizer/algebra/rename/offset_operand/optimize_spec.rb