onyx-cache-money 0.2.5.1 → 0.2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/TODO +1 -0
- data/lib/cash/util/marshal.rb +1 -1
- data/spec/cash/marshal_spec.rb +16 -0
- metadata +1 -1
data/TODO
CHANGED
data/lib/cash/util/marshal.rb
CHANGED
@@ -8,7 +8,7 @@ module Marshal
|
|
8
8
|
begin
|
9
9
|
Marshal.load_without_constantize value
|
10
10
|
rescue ArgumentError => e
|
11
|
-
_, class_name = *(/undefined class\/module (\w
|
11
|
+
_, class_name = *(/undefined class\/module ([\w:]*\w)/.match(e.message))
|
12
12
|
raise if !class_name
|
13
13
|
constantize(class_name)
|
14
14
|
Marshal.load value
|
data/spec/cash/marshal_spec.rb
CHANGED
@@ -15,6 +15,22 @@ describe Marshal do
|
|
15
15
|
stub(Marshal).constantize(@reference_to_constant.name) { Object.send(:const_set, :Constant, @reference_to_constant) }
|
16
16
|
Marshal.load(@marshaled_object).class.should == @object.class
|
17
17
|
end
|
18
|
+
|
19
|
+
it 'loads the constant with the scope operator' do
|
20
|
+
module Foo; class Bar; end; end
|
21
|
+
|
22
|
+
reference_to_module = Foo
|
23
|
+
reference_to_constant = Foo::Bar
|
24
|
+
object = reference_to_constant.new
|
25
|
+
marshaled_object = Marshal.dump(object)
|
26
|
+
|
27
|
+
Foo.send(:remove_const, :Bar)
|
28
|
+
Object.send(:remove_const, :Foo)
|
29
|
+
stub(Marshal).constantize(reference_to_module.name) { Object.send(:const_set, :Foo, reference_to_module) }
|
30
|
+
stub(Marshal).constantize(reference_to_constant.name) { Foo.send(:const_set, :Bar, reference_to_constant) }
|
31
|
+
|
32
|
+
Marshal.load(marshaled_object).class.should == object.class
|
33
|
+
end
|
18
34
|
end
|
19
35
|
|
20
36
|
describe 'when the constant does not exist' do
|