Sha256: 0bd8733fe4b044779eb7535a70cf82f92942b24c95a9fab97471390ed310f178
Contents?: true
Size: 918 Bytes
Versions: 2
Compression:
Stored size: 918 Bytes
Contents
# -*- encoding: utf-8 -*- require 'spec_helper' describe Equatable, '#eql?' do let(:name) { 'Value' } let(:value) { 11 } let(:klass) { ::Class.new do include Equatable attr_reader :value def initialize(value) @value = value end end } let(:object) { klass.new(value) } subject { object.eql?(other) } 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(klass).new(value) } it { should be_false } it 'is symmetric' do should eql(other.eql?(object)) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
equatable-0.4.0 | spec/equatable/eql_spec.rb |
equatable-0.3.0 | spec/equatable/eql_spec.rb |