[rspec-users] How to unit test code that connects to the external resources?

Yi Wen hayafirst at gmail.com
Mon Sep 8 13:12:47 EDT 2008

By external resources, I mean, the code start a http connection and GET xmls
from the url specified. I will definitely not rely my unit test on an
external url or anything like that. But how do I unit test the method? I
mean, I can basically mock the Net::HTTP, but then the test will pretty much
be like the method itself, except all the calls will be replaced by stub! or

I made this method as simple as possible. There is no *if* statements or
loop in the method, should I just NOT test this one?

Thanks for any ideas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080908/ae51bae1/attachment.html>

More information about the rspec-users mailing list