Sha256: b2e9f222a5fdbdab2fd7a84afed1345997e2e83b30e1479c9afeb58f2e6406cf

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.1 spec/unit/axiom/relation/operation/order/direction/rename_spec.rb