[rspec-users] How to mock out a WEBrick::HTTPServer?

Evgeni Dzhelyov evgeni.dzhelyov at gmail.com
Sun Jan 15 11:49:57 EST 2012


I read your pastie and your Proxy class is tightly coupled with
Webrick, you should decouple it and supply mocked object in the test
environment.

Some people use approach like this:

class A
  def initialize(server = WEBrick::HTTPServer)
  end
end

And in test env initialize the A class like this:

A.new(MockedHTTPServer)


More information about the rspec-users mailing list