Closed PatrickLef closed 13 years ago
Try:
stub(Object).send(method_name, "foo")
Nothing special, just plain ol' Ruby :)
P.S., it's kind of frowned upon to ask questions in an issue tracker. You'd have better luck pinging Brian directly.
Actually, that would work, but if I'm reading #28 correctly, calling send
on a stub will stub send
instead of actually sending the method. You might try
stub(Object).__send__(method_name, "foo")
send seems to make the trick. Yes, I should probably have asked this on stackoverflow or something. It feels wrong to ask the creator of an opens source project since it is more of an question for the whole community.
Is it worth to add this to the readme? Thanks!
Is it possible to mock a method if the method name is in a variable?
For example