Sha256: a798ee4ca9f08ef708415ac235b9fd913062f508691b3422c631e1386f1c8ab0

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Attribute#eql?' do
  subject { object.eql?(other) }

  let(:klass)  { Attribute::Integer }
  let(:name)   { :id                }
  let(:object) { klass.new(name)    }

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

    it { should be(true) }

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

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

    it { should be(true) }

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

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

    it { should be(false) }

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

  context 'with an object having a different name' do
    let(:other_name) { :other_id             }
    let(:other)      { klass.new(other_name) }

    it { should be(false) }

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/attribute/eql_spec.rb