Sha256: 02c9b976c82a8f1e6e784ac14048de92b159adcd25db434562f38b2b9fcd3ba6

Contents?: true

Size: 729 Bytes

Versions: 3

Compression:

Stored size: 729 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Algebra::Rename::Aliases, '#inverse' do
  subject { object.inverse }

  let(:object)    { described_class.new(aliases) }
  let(:attribute) { Attribute::Integer.new(:id)  }

  context 'when aliases are empty' do
    let(:aliases) { {} }

    it_should_behave_like 'an invertible method'

    it { should be_instance_of(described_class) }

    its(:to_hash) { should == {} }
  end

  context 'when aliases are not empty' do
    let(:aliases) { { attribute => attribute.rename(:other_id) } }

    it_should_behave_like 'an invertible method'

    it { should be_instance_of(described_class) }

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
axiom-0.2.0 spec/unit/axiom/algebra/rename/aliases/inverse_spec.rb
axiom-0.1.1 spec/unit/axiom/algebra/rename/aliases/inverse_spec.rb
axiom-0.1.0 spec/unit/axiom/algebra/rename/aliases/inverse_spec.rb