Sha256: 2c80488542ca8a53a1298379a3f288dc38e3e5c16a09e36cf957eb755e2bce2d

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

  before do
    expect(object.operation).to be_kind_of(Relation::Operation::Sorted)
  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

1 entries across 1 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 spec/unit/axiom/optimizer/relation/operation/sorted/unoptimized_operand/optimizable_predicate_spec.rb