spec/dbee/model/constraints/reference_spec.rb in dbee-1.0.3 vs spec/dbee/model/constraints/reference_spec.rb in dbee-1.1.0

- old
+ new

@@ -21,17 +21,24 @@ context 'equality' do let(:config) { { name: 'id', parent: 'patient_id' } } subject { described_class.new(config) } - specify '#hash produces same output as concatenated string hash of name and parent' do - expect(subject.hash).to eq("#{config[:name]}#{config[:parent]}".hash) + specify '#hash produces same output as string hash of class name, name, and parent' do + expected_hash = "#{described_class.name}#{config[:name]}#{config[:parent]}".hash + + expect(subject.hash).to eq(expected_hash) end specify '#== and #eql? compare attributes' do object2 = described_class.new(config) expect(subject).to eq(object2) expect(subject).to eql(object2) + end + + it 'returns false unless comparing same object types' do + expect(subject).not_to eq(config) + expect(subject).not_to eq(nil) end end end