Sha256: 41dc76ab4f35ae464e7ccf2af5b8be1e6b3826919c391d714b626bf4ef0d3cbf
Contents?: true
Size: 992 Bytes
Versions: 3
Compression:
Stored size: 992 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' describe Basquiat::HashRefinements do using Basquiat::HashRefinements subject(:hash) do { 'key' => 1, 'another_key' => 2, 3 => 3, 'array' => [1, 3, 5], 'hash' => { 'inner_key' => 6 } } end it '#deep_merge' do hash.deep_merge('hash' => { 'inner_key' => 7, 'other_inner_key' => 10 }) expect(hash['hash']).to have_key('other_inner_key') expect(hash['hash']['inner_key']).to eq(7) end it '#deep_merge with nested different hashes' do base = { queue: { options: { some: 'value' } } } other = { queue: { options: { another: 'setting' } } } base.deep_merge(other) expect(base[:queue][:options].keys).to contain_exactly(:some, :another) end it '#symbolize_keys' do symbol_hash = hash.symbolize_keys expect(symbol_hash).to have_key(:array) expect(symbol_hash).to have_key(3) expect(symbol_hash).to have_key(:hash) expect(symbol_hash[:hash]).to have_key(:inner_key) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
basquiat-1.3.2 | spec/lib/support/hash_refinements_spec.rb |
basquiat-1.3.1 | spec/lib/support/hash_refinements_spec.rb |
basquiat-1.3.0 | spec/lib/support/hash_refinements_spec.rb |