Sha256: 76cee3a3c4264c33431c49e914374429088d107ebae4a54caf23f42f55e1a5d8

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 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_instance_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

4 entries across 4 versions & 2 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/relation/operation/order/direction/rename_spec.rb
veritas-0.0.7 spec/unit/veritas/relation/operation/order/direction/rename_spec.rb
veritas-0.0.6 spec/unit/veritas/relation/operation/order/direction/rename_spec.rb
veritas-0.0.5 spec/unit/veritas/relation/operation/order/direction/rename_spec.rb