Skip to content

Commit

Permalink
lib/delegate: Added basic specs for marshalling.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre committed Dec 24, 2009
1 parent 3911cc2 commit b1169bd
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions library/delegate/marshal_spec.rb
@@ -0,0 +1,23 @@
require File.dirname(__FILE__) + '/../../spec_helper'
require 'delegate'

describe "SimpleDelegator" do
before :each do
@obj = "hello"
@delegate = SimpleDelegator.new(@obj)
end

it "can be marshalled" do
m = Marshal.load(Marshal.dump(@delegate))
m.class.should == SimpleDelegator
(m == @obj).should be_true
end

ruby_bug "redmine:1744", "1.8.7" do
it "can be marshalled with its instance variables intact" do
@delegate.instance_variable_set(:@foo, "bar")
m = Marshal.load(Marshal.dump(@delegate))
m.instance_variable_get(:@foo).should == "bar"
end
end
end

0 comments on commit b1169bd

Please sign in to comment.