Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix variable scope bug in mongrel adapter. Fixes #33

  • Loading branch information...
commit 1f3858b0b00caa76c447e9401d4ffc9f65f77b65 1 parent e7fa92a
@samwgoldman samwgoldman authored
View
9 lib/webmachine/adapters/mongrel.rb
@@ -13,13 +13,14 @@ class Mongrel < Adapter
# Starts the Mongrel adapter
def run
- options = {
+ defaults = {
:port => configuration.port,
- :host => configuration.ip
+ :host => configuration.ip,
+ :dispatcher => dispatcher
}.merge(configuration.adapter_options)
- config = ::Mongrel::Configurator.new(options) do
+ config = ::Mongrel::Configurator.new(defaults) do
listener do
- uri '/', :handler => Webmachine::Adapters::Mongrel::Handler.new(dispatcher)
+ uri '/', :handler => Webmachine::Adapters::Mongrel::Handler.new(defaults[:dispatcher])
end
trap("INT") { stop }
run
View
3  spec/webmachine/adapters/mongrel_spec.rb
@@ -48,6 +48,9 @@
end
it "can run" do
+ # Prevent webserver thread from taking over
+ Thread.stub!(:new).and_return(stub(:join => nil))
+
expect {
adapter.run
}.not_to raise_error
Please sign in to comment.
Something went wrong with that request. Please try again.