[rspec-users] Stubbing a Kernel method?

Paul Dlug paul.dlug at gmail.com
Fri Oct 19 12:18:55 EDT 2007


Is it possible to stub a Kernel method? I'm specifically interested in
the 'open' method to test some code using open-uri. I've tried:

Kernel.should_receive(:open).with('filename').and_return('data')

However, this doesn't seem to work. Any suggestions would be appreciated.


--Paul


More information about the rspec-users mailing list