Sha256: 3fcf04868d9ebe6c1c844df4df48d27cf2fe2cd19be4143d6a3289049e95512a

Contents?: true

Size: 986 Bytes

Versions: 4

Compression:

Stored size: 986 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 equal(object) }
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/function/unary/rename_spec.rb
veritas-0.0.7 spec/unit/veritas/function/unary/rename_spec.rb
veritas-0.0.6 spec/unit/veritas/function/unary/rename_spec.rb
veritas-0.0.5 spec/unit/veritas/function/unary/rename_spec.rb