Sha256: 9a7432a4e440330a12596aac3e337ff6c572ccf8dbe227fbda1fe72195e6644b

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

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

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

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

    it { should be_kind_of(klass) }

    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.2 spec/unit/veritas/relation/operation/order/direction/rename_spec.rb