Sha256: fe64cfeebfb83fdfd918d4b54145963cee6a100ed86ca584078ac19217e677ed

Contents?: true

Size: 965 Bytes

Versions: 2

Compression:

Stored size: 965 Bytes

Contents

# encoding: utf-8

require 'spec_helper'
require File.expand_path('../fixtures/classes', __FILE__)

describe Function::Unary, '#rename' do
  subject { object.rename(aliases) }

  let(:described_class) { UnarySpecs::Object                                     }
  let(:attribute)       { Attribute::Integer.new(:id)                            }
  let(:other)           { attribute.rename(:other_id)                            }
  let(:header)          { Relation::Header.new([attribute])                      }
  let(:aliases)         { Algebra::Rename::Aliases.coerce(header, id: :other_id) }
  let(:object)          { described_class.new(operand)                           }

  context 'operand is renamed' do
    let(:operand) { attribute.eq(1) }

    it { should be_instance_of(described_class) }

    its(:operand) { should eql(other.eq(1)) }
  end

  context 'operand is not renamed' do
    let(:operand) { other.eq(1) }

    it { should be(object) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-0.2.0 spec/unit/axiom/function/unary/rename_spec.rb
axiom-0.1.1 spec/unit/axiom/function/unary/rename_spec.rb