Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/ice_nine/freezer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def self.find(name)
# @api private
def self.const_lookup(namespace)
const_get(namespace) if const_defined?(namespace, nil)
rescue NameError
nil
end

# Deep freeze an object with a particular Freezer and RecursionGuard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ class User; end
end
end

describe 'when the module is a class created by instance_eval' do
let(:mod) { Object.new.instance_eval('class User; end; User') }

it 'returns the freezer' do
should be(freezer)
end
end

describe 'when the module is a struct' do
let(:mod) { Struct.new(:a) }
let(:freezer) { IceNine::Freezer::Struct }
Expand Down