Sha256: be5bc82f7857a9a124b909329a568b85e0d3371eb93abda7c44f96ebdef3adf9

Contents?: true

Size: 838 Bytes

Versions: 10

Compression:

Stored size: 838 Bytes

Contents

# encoding: utf-8

require 'spec_helper'
require 'ice_nine'

describe IceNine::Freezer::Object, '.deep_freeze' do
  subject { object.deep_freeze(value) }

  let(:object) { described_class }

  context 'with an Object' do
    let(:value) { Object.new }

    context 'without a circular reference' do
      it_behaves_like 'IceNine::Freezer::Object.deep_freeze'
    end

    context 'with a circular reference' do
      before do
        value.instance_eval { @b = self }
      end

      it_behaves_like 'IceNine::Freezer::Object.deep_freeze'
    end
  end

  context 'with an Object which undefs :freeze' do
    let(:value) { UndefFreeze.new }

    before do
      klass = Class.new do
        undef :freeze
      end

      stub_const('UndefFreeze', klass)
    end

    it_behaves_like 'IceNine::Freezer::NoFreeze.deep_freeze'
  end
end

Version data entries

10 entries across 8 versions & 4 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/freezer/object/class_methods/deep_freeze_spec.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/freezer/object/class_methods/deep_freeze_spec.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/freezer/object/class_methods/deep_freeze_spec.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/freezer/object/class_methods/deep_freeze_spec.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/freezer/object/class_methods/deep_freeze_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/freezer/object/class_methods/deep_freeze_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/freezer/object/class_methods/deep_freeze_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/freezer/object/class_methods/deep_freeze_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/freezer/object/class_methods/deep_freeze_spec.rb
ice_nine-0.11.2 spec/unit/ice_nine/freezer/object/class_methods/deep_freeze_spec.rb