Sha256: d1cb4b841d7e98f0f2104df28dd96c651612b3f3e188de291ab673e93bead15b

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

#
# Copyright (c) 2019-present, Blue Marble Payroll, LLC
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#

require 'spec_helper'

describe ::Hashematics::Key do
  describe '#eql?' do
    it 'should compare Key objects' do
      expect(described_class.new('id')).to eq(described_class.new('id'))
      expect(described_class.new('id')).to eq(described_class.new(:id))
      expect(described_class.new(['id'])).to eq(described_class.new('id'))
      expect(described_class.new([:id])).to eq(described_class.new('id'))
      expect(described_class.new([:id])).to eq(described_class.new(['id']))
    end

    it 'should compare Key with string' do
      expect(described_class.new('id')).to eq('id')
      expect(described_class.new(:id)).to eq('id')
    end

    it 'should compare Key with symbol' do
      expect(described_class.new('id')).to eq(:id)
      expect(described_class.new(:id)).to eq(:id)
    end

    it 'should compare Key with array' do
      expect(described_class.new('id')).to eq(['id'])
      expect(described_class.new(:id)).to eq([:id])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hashematics-1.1.0 spec/hashematics/key_spec.rb
hashematics-1.0.0 spec/hashematics/key_spec.rb