Sha256: 09dea3e08074acdbeab67b8175db3775619f3f1bcde842eea97d8d6026b0b41c

Contents?: true

Size: 744 Bytes

Versions: 3

Compression:

Stored size: 744 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Relation::Operation::Order::UnoptimizedOperand, '#optimizable?' do
  subject { object.optimizable? }

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

  before do
    object.operation.should be_kind_of(Relation::Operation::Order)
  end

  context 'when the operand is optimizable' do
    let(:operand) { base.rename({}) }

    it { should be(true) }
  end

  context 'when the operand is not optimizable' do
    let(:operand) { base }

    it { should be(false) }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/relation/operation/order/unoptimized_operand/optimizable_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/relation/operation/order/unoptimized_operand/optimizable_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/relation/operation/order/unoptimized_operand/optimizable_spec.rb