Sha256: fd24fec24c60ad045e2eda4b7c0216eb09ac8a8e238adb36063817630dcd282b
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
# encoding: utf-8 require 'spec_helper' require 'ice_nine' describe IceNine::Freezer::Hash, '.deep_freeze' do subject { object.deep_freeze(value) } let(:object) { described_class } context 'with a Hash object having a default proc' do let(:value) do Hash.new { }.update(Object.new => Object.new) end it_behaves_like 'IceNine::Freezer::Hash.deep_freeze' it 'freezes the default proc' do expect(subject.default_proc).to be_frozen end end context 'with a Hash object having a default value' do let(:value) do Hash.new('').update(Object.new => Object.new) end it_behaves_like 'IceNine::Freezer::Hash.deep_freeze' it 'freezes the default value' do expect(subject.default).to be_frozen end context 'that is a circular reference' do before { value.default = value } it_behaves_like 'IceNine::Freezer::Hash.deep_freeze' it 'freezes the default value' do expect(subject.default).to be_frozen end end end context 'with a Hash object containing itself as a key' do let(:value) do value = {} value[value] = '1' value end it_behaves_like 'IceNine::Freezer::Hash.deep_freeze' end context 'with a Hash object containing itself as a value' do let(:value) do value = {} value['a'] = value value end it_behaves_like 'IceNine::Freezer::Hash.deep_freeze' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ice_nine-0.11.0 | spec/unit/ice_nine/freezer/hash/class_methods/deep_freeze_spec.rb |