Sha256: 61e2a96134648a3221f94db4a23bdf2ad3b39773fa9fb0b5bdaefacc8a7abca0

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Axiom::Equalizer::Methods, '#eql?' do
  subject { object.eql?(other) }

  let(:object) { described_class.new }

  let(:described_class) do
    Class.new do
      include Axiom::Equalizer::Methods

      def cmp?(comparator, other)
        !!(comparator and other)
      end
    end
  end

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

    it { should be(true) }

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

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

    it { should be(true) }

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

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

    it { should be(false) }

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/equalizer/methods/eql_spec.rb