Sha256: 269653ce801347e78e0b55f36cd100176ba82bfe1da0d71dfbd7d827a53fecb3

Contents?: true

Size: 883 Bytes

Versions: 2

Compression:

Stored size: 883 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Algebra::Extension::UnoptimizedOperand, '#optimize' do
  subject { object.optimize }

  let(:header)    { Relation::Header.coerce([[:id, Integer]])         }
  let(:base)      { Relation.new(header, LazyEnumerable.new([[1]]))   }
  let(:attribute) { Attribute::Object.new(:text)                      }
  let(:function)  { Function::Numeric::Absolute.new(1)                }
  let(:operand)   { base.rename({})                                   }
  let(:relation)  { operand.extend { |r| r.add(attribute, function) } }
  let(:object)    { described_class.new(relation)                     }

  before do
    expect(object).to be_optimizable
  end

  it { should_not be(operand) }

  it { should be_kind_of(Algebra::Extension) }

  its(:operand) { should be(base) }

  its(:extensions) { should == { attribute => 1 } }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 spec/unit/axiom/optimizer/algebra/extension/unoptimized_operand/optimize_spec.rb
axiom-optimizer-0.1.1 spec/unit/axiom/optimizer/algebra/extension/unoptimized_operand/optimize_spec.rb