diff --git a/spec/core/marshal/dump_spec.rb b/spec/core/marshal/dump_spec.rb index 5be7b74f3..c2bfdc034 100644 --- a/spec/core/marshal/dump_spec.rb +++ b/spec/core/marshal/dump_spec.rb @@ -233,9 +233,7 @@ def _dump(level) end it "raises TypeError with a singleton Class" do - NATFIXME 'raises TypeError with a singleton Class', exception: SpecFailedException do - -> { Marshal.dump(class << self; self end) }.should raise_error(TypeError) - end + -> { Marshal.dump(class << self; self end) }.should raise_error(TypeError) end end diff --git a/src/marshal.rb b/src/marshal.rb index eb36abdec..badd0995f 100644 --- a/src/marshal.rb +++ b/src/marshal.rb @@ -219,6 +219,7 @@ def write_hash(values) end def write_class(value) + raise TypeError, "singleton class can't be dumped" if value.singleton_class? write_char('c') write_string_bytes(value.name) end