Displaying 1 result from an estimated 1 matches for "mysingleton".
Did you mean:
issingleton
2007 Aug 21
7
mocking singletons
...lobal
$my_global.expects(:foo).returns(''bar'')
yield
$my_global = original
end
Is there something similar I can do for a singleton? Right now I have
this:
def mock_my_singleton
m = mock("my singleton")
m.expects(:foo).returns(''bar'')
MySingleton.expects(:instance).returns(m)
yield
end
Thanks for your help.
-justin
list mods: I sent a previous message to the list but my membership
was pending so my message is too. This message is more concise than
my previous one so please do not approve it :)