Sha256: 5b7c85a03a36d037156263dace93587556c3395e8ae8974ce78064d219832558

Contents?: true

Size: 664 Bytes

Versions: 3

Compression:

Stored size: 664 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

  before do
    object.should be_optimizable
  end

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

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

  its(:directions) { should == [ relation[:other_id].asc ] }
end

Version data entries

3 entries across 3 versions & 1 rubygems

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