Created
May 22, 2012 02:38
-
-
Save kyamaguchi/2766192 to your computer and use it in GitHub Desktop.
Rspec webrick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/support/bindaddress.rb | |
# Equivalent to $ rails server -b 127.0.0.1 | |
require 'webrick' | |
module Rack | |
module Handler | |
class WEBrick | |
def self.run(app, options={}) | |
options[:BindAddress] = '127.0.0.1' | |
@server = ::WEBrick::HTTPServer.new(options) | |
@server.mount "/", Rack::Handler::WEBrick, app | |
yield @server if block_given? | |
@server.start | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment