Sha256: 6a3be7b06f62dc22b75924f163e9af65ebe900d40f48cc004dd542e7ae28903c

Contents?: true

Size: 669 Bytes

Versions: 3

Compression:

Stored size: 669 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

  before do
    object.should be_optimizable
  end

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/algebra/rename/offset_operand/optimize_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/algebra/rename/offset_operand/optimize_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/algebra/rename/offset_operand/optimize_spec.rb