Sha256: a938352dc9fe1aed1229039dfe037d353bf2a0671ef10b84f9ae4b2f1ee6bb80

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe 'Veritas::Algebra::Rename::Aliases#==' do
  subject { object == other }

  let(:klass)     { Algebra::Rename::Aliases                     }
  let(:attribute) { Attribute::Integer.new(:id)                  }
  let(:aliases)   { { attribute => attribute.rename(:other_id) } }
  let(:object)    { klass.new(aliases)                           }

  context 'with the same object' do
    let(:other) { object }

    it { should be(true) }

    it 'is symmetric' do
      should == (other == object)
    end
  end

  context 'with an equivalent object' do
    let(:other) { object.dup }

    it { should be(true) }

    it 'is symmetric' do
      should == (other == object)
    end
  end

  context 'with an equivalent object of a subclass' do
    let(:other) { Class.new(klass).new(aliases) }

    it { should be(true) }

    it 'is symmetric' do
      should == (other == object)
    end
  end

  context 'with an object having different aliases' do
    let(:other_aliases) { { attribute => attribute.rename(:another_id) } }
    let(:other)         { klass.new(other_aliases)                       }

    it { should be(false) }

    it 'is symmetric' do
      should == (other == object)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/algebra/rename/aliases/equal_value_spec.rb