Sha256: 32f9f206260f4ef3ec9373aaf79a589ec151d75265247a2962ae3027c5f12726
Contents?: true
Size: 1012 Bytes
Versions: 2
Compression:
Stored size: 1012 Bytes
Contents
# encoding: utf-8 require 'spec_helper' require 'ice_nine' describe IceNine, '.deep_freeze' do subject { object.deep_freeze(value) } let(:object) { IceNine } let(:value) { Object.new } before do value.instance_eval { @a = '1' } end context 'when the object is not frozen' do 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 the instance variables in the Object' do subject.instance_variable_get(:@a).should be_frozen end end context 'when the object is frozen' do before do value.freeze end it 'returns the object' do should be(value) end it 'does not freeze the object' do expect { subject }.to_not change(value, :frozen?).from(true) end it 'does not freeze the instance variables in the Object' do subject.instance_variable_get(:@a).should_not be_frozen end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ice_nine-0.8.0 | spec/unit/ice_nine/class_methods/deep_freeze_spec.rb |
ice_nine-0.7.0 | spec/unit/ice_nine/class_methods/deep_freeze_spec.rb |