Sha256: 3139e096ad1ea68e3d874ef2afde91ff568354ddbf8cfb424dccd0dd8512d037
Contents?: true
Size: 998 Bytes
Versions: 1
Compression:
Stored size: 998 Bytes
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' do let(:value) { { Object.new => Object.new } } it 'returns the object' do should be(value) end it 'freezes the object' do expect { subject }.to change(value, :frozen?).from(false).to(true) end it 'freezes each key in the Hash' do subject.keys.select(&:frozen?).should == subject.keys end it 'freezes each value in the Hash' do subject.values.select(&:frozen?).should == subject.values end if RUBY_VERSION >= '1.9' and RUBY_ENGINE == 'rbx' it 'does not freeze the Hash state' do subject.instance_variable_get(:@state).should_not be_frozen end it 'does not freeze the Hash entries' do subject.instance_variable_get(:@entries).should_not be_frozen end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ice_nine-0.7.0 | spec/unit/ice_nine/freezer/hash/class_methods/deep_freeze_spec.rb |