Sha256: 32435ae11f062ef25ae9fe8708412ffb3b3ff34e210846d070affe6562f8e51d
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
# encoding: utf-8 require 'spec_helper' require File.expand_path('../fixtures/classes', __FILE__) describe Immutable, '#freeze' do subject { object.freeze } let(:described_class) { Class.new(ImmutableSpecs::Object) } before do described_class.memoize(:test) end context 'with an unfrozen object' do let(:object) { described_class.allocate } it { should equal(object) } it 'freezes the object' do expect { subject }.to change(object, :frozen?). from(false). to(true) end it 'sets a memoization instance variable' do object.should_not be_instance_variable_defined(:@__memory) subject object.instance_variable_get(:@__memory).should be_kind_of(Immutable::Memory) end end context 'with a frozen object' do let(:object) { described_class.new } it { should equal(object) } it 'does not change the frozen state of the object' do expect { subject }.to_not change(object, :frozen?) end it 'does not change the memoization instance variable' do expect { subject }.to_not change { object.instance_variable_get(:@__memory) } end it 'sets an instance variable for memoization' do subject.instance_variable_get(:@__memory).should be_kind_of(Immutable::Memory) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
veritas-0.0.4 | spec/unit/veritas/immutable/freeze_spec.rb |