On Oct 19, 2007, at 5:18 pm, Paul Dlug wrote:

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

Had this exact same issue with OpenURI myself two days ago.  The  
other replies are better OO but the quickest way it to use the  
OpenURI.open_uri class method, which you can stub out without  
interfering with Kernel.  (Unless you want it to handle files as well  
as URLs that is.)

BTW I have no idea what the OpenURI.open_uri method is all about, as  
open-uri's wrapper to Kernel.open does not call it.  But it seems to  
work...

Ashley


--
blog @ http://aviewfromafar.net/
linked-in @ http://www.linkedin.com/in/ashleymoran
currently @ home

_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to