Sha256: b1efff1ef08fcf8634873485de003758acfa5fecfb39936de2d1fa2c990d498b

Contents?: true

Size: 744 Bytes

Versions: 2

Compression:

Stored size: 744 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:header)    { Relation::Header.coerce([[:id, Integer]])         }
  let(:base)      { Relation.new(header, LazyEnumerable.new([[1]]))   }
  let(:predicate) { base[:id].eq(1)                                   }
  let(:relation)  { base.restrict { predicate }.rename(id: :other_id) }
  let(:object)    { described_class.new(relation)                     }

  before do
    expect(object).to be_optimizable
  end

  it { should be_kind_of(Algebra::Restriction) }

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

  its(:predicate) { should == header[:id].rename(:other_id).eq(1) }
end

Version data entries

2 entries across 2 versions & 1 rubygems

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