File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ class UserPreviouslyDefinedWithInitializedIvar
83
83
end
84
84
85
85
class UserMarshal
86
- attr_reader :data
86
+ attr_accessor :data
87
87
88
88
def initialize
89
89
@data = 'stuff'
Original file line number Diff line number Diff line change 309
309
310
310
it "loads an extended Array object containing a user-marshaled object" do
311
311
obj = [ UserMarshal . new , UserMarshal . new ] . extend ( Meths )
312
- new_obj = Marshal . send ( @method , "\x04 \b e:\n Meths[\a o:\x10 UserMarshal\x06 :\n @dataI\" \n stuff\x06 :\x06 ETo;\x06 \x06 ;\a I\" \n stuff\x06 ;\b T" )
312
+ dump = "\x04 \b e:\n Meths[\a o:\x10 UserMarshal\x06 :\n @dataI\" \n stuff\x06 :\x06 ETo;\x06 \x06 ;\a I\" \n stuff\x06 ;\b T"
313
+ new_obj = Marshal . send ( @method , dump )
313
314
314
315
new_obj . should == obj
315
316
obj_ancestors = class << obj ; ancestors [ 1 ..-1 ] ; end
609
610
end
610
611
end
611
612
613
+ describe "for an object responding to #marshal_dump and #marshal_load" do
614
+ it "loads a user-marshaled object" do
615
+ obj = UserMarshal . new
616
+ obj . data = :data
617
+ value = [ obj , :data ]
618
+ dump = Marshal . dump ( value )
619
+ dump . should == "\x04 \b [\a U:\x10 UserMarshal:\t data;\x06 "
620
+ reloaded = Marshal . load ( dump )
621
+ reloaded . should == value
622
+ end
623
+ end
624
+
612
625
describe "for a user object" do
613
626
it "loads a user-marshaled extended object" do
614
627
obj = UserMarshal . new . extend ( Meths )
You can’t perform that action at this time.
0 commit comments