Sha256: 026b44f25c3d3ee6acff13730492d29b7a9a1a4f22758a6818fc25743d4f7bf6

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Operation::Order::Direction, '#rename' do
  subject { object.rename(aliases) }

  let(:described_class) { Class.new(Relation::Operation::Order::Direction) }
  let(:attribute)       { Attribute::Integer.new(:id)                      }
  let(:header)          { Relation::Header.new([ attribute ])              }
  let(:object)          { described_class.new(attribute)                   }

  context 'with aliases matching the attribute' do
    let(:aliases) { Algebra::Rename::Aliases.coerce(header, :id => :other_id) }

    it { should be_kind_of(described_class) }

    its(:attribute) { should == attribute.rename(:other_id) }
  end

  context 'with aliases not matching the attribute' do
    let(:other_attribute) { Attribute::String.new(:name)                                        }
    let(:other_header)    { Relation::Header.new([ other_attribute ])                           }
    let(:aliases)         { Algebra::Rename::Aliases.coerce(other_header, :name => :other_name) }

    it { should equal(object) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.4 spec/unit/veritas/relation/operation/order/direction/rename_spec.rb