[rspec-users] Low level HTTP server mocking
ianrvaughan at gmail.com
Sat Jan 14 16:57:28 EST 2012
I have a class which creates a WEBrick::HTTPServer, and in my tests I
obviously do not want to instantiate/open this server, as (a) its a
resource waste (b) would hang the test (c) is not under-test.
1. How can I stub it out?
2. How can I mock the call to #mount_proc, such that, when my dir/route
gets hit, the real code runs?
Or put another way, I want to test that my mapping/routing is correct, such
that if I get "/", my HTTPServer, I get "hello" back.
I want to use as least amount of external libs as possible, so to learn
whats going on. (ie not yet use webmock/fakeweb/etc)
Code : http://pastie.org/3186140
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users