Sha256: afa9ce21f521126e74456ef7f6c24b220c620bf4de948578bab4a4436dc9cfe6

Contents?: true

Size: 693 Bytes

Versions: 1

Compression:

Stored size: 693 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:base)     { Relation.new([[:id, Integer]], LazyEnumerable.new([[1]])) }
  let(:operand)  { base.sort_by { |r| r.id }                                 }
  let(:relation) { operand.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::Sorted) }

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

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