Sha256: d9aced0ac61687c8ddfbb10fd3a8f0e73ea2c54d049f24349237fa4f394e55f8

Contents?: true

Size: 692 Bytes

Versions: 10

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

require 'core_extensions/hash'

RSpec.describe CoreExtensions::Hash do
  before do
    Hash.include described_class
  end

  describe '#except' do
    it 'should return a copy of the original hash with the given keys removed' do
      tested_hash = { a: true, b: false, c: nil }
      expect(tested_hash.except(:c)).to eql({ a: true, b: false })
      expect(tested_hash).to eql({ a: true, b: false, c: nil })

      tested_hash = { a: 100, b: 200, c: 300 }
      expect(tested_hash.except(:a)).to eql({ b: 200, c: 300 })
      expect(tested_hash.except(:a, :c)).to eql({ b: 200 })
      expect(tested_hash).to eql({ a: 100, b: 200, c: 300 })
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
intranet-core-2.4.5 spec/core_extensions/hash_spec.rb
intranet-core-2.4.4 spec/core_extensions/hash_spec.rb
intranet-core-2.4.3 spec/core_extensions/hash_spec.rb
intranet-core-2.4.1 spec/core_extensions/hash_spec.rb
intranet-core-2.4.0 spec/core_extensions/hash_spec.rb
intranet-core-2.3.3 spec/core_extensions/hash_spec.rb
intranet-core-2.3.2 spec/core_extensions/hash_spec.rb
intranet-core-2.3.1 spec/core_extensions/hash_spec.rb
intranet-core-2.3.0 spec/core_extensions/hash_spec.rb
intranet-core-2.2.0 spec/core_extensions/hash_spec.rb