Sha256: 4388bfaae5f442dce58d0eaa418c9a99ed3a049906870c9a834bdda417d129b9

Contents?: true

Size: 1.16 KB

Versions: 54

Compression:

Stored size: 1.16 KB

Contents

require 'vm_shepherd/data_object'

module VmShepherd
  class TestDataObject
    include DataObject

    attr_accessor :name
  end

  RSpec.describe(DataObject) do
    describe '#==' do
      it 'returns false for objects of a different class' do
        class DifferentDataObject
          include DataObject
        end

        expect(TestDataObject.new == DifferentDataObject.new).to be_falsey
      end

      it 'returns true for objects of a descendent class' do
        class DescendentDataObject < TestDataObject
          include DataObject
        end

        expect(TestDataObject.new == DescendentDataObject.new).to be_truthy
      end

      it 'returns false when any attribute is unequal' do
        a = TestDataObject.new
        b = TestDataObject.new

        a.name = 'a'
        b.name = 'b'

        expect(a == b).to be_falsey
      end

      it 'returns true when all attributes are equal' do
        eleventy_one       = TestDataObject.new
        hundred_and_eleven = TestDataObject.new

        eleventy_one.name       = '111'
        hundred_and_eleven.name = '111'

        expect(eleventy_one == hundred_and_eleven).to be_truthy
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
vm_shepherd-3.7.3 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.7.1 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.7.0 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.6.2 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.6.1 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.6.0 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.5.0 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.4.3 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.4.2 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.4.1 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.4.0 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.3.2 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.3.1 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.3.0 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.2.1 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.2.0 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.1.8 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.1.7 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.1.6 spec/vm_shepherd/data_object_spec.rb
vm_shepherd-3.1.5 spec/vm_shepherd/data_object_spec.rb