Permalink
Browse files

Merge pull request #38 from samwgoldman/mongrel_configure_scope

Mongrel configure scope
  • Loading branch information...
2 parents a942971 + 1f3858b commit b543db2648ada02cda681e2f0e52eca5a385e13b @samwgoldman samwgoldman committed Mar 8, 2012
Showing with 14 additions and 4 deletions.
  1. +5 −4 lib/webmachine/adapters/mongrel.rb
  2. +9 −0 spec/webmachine/adapters/mongrel_spec.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
@@ -46,6 +46,15 @@
chunks.join.should eq("Hello, World!")
end
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
+ end
end
rescue LoadError
warn "Platform is #{RUBY_PLATFORM}: skipping mongrel adapter spec."

0 comments on commit b543db2

Please sign in to comment.