summaryrefslogtreecommitdiffstats
path: root/spec/unit/network/http/webrick.rb
diff options
context:
space:
mode:
authorRick Bradley <rick@rickbradley.com>2007-10-15 12:16:48 -0500
committerRick Bradley <rick@rickbradley.com>2007-10-15 12:16:48 -0500
commite56406f15086eb483c00a2904d8a75518412a905 (patch)
tree6a0a062750906cdf92c8975208fc873ae1c0c542 /spec/unit/network/http/webrick.rb
parentec71e05a162ec299982b90707cc16231c608997b (diff)
downloadpuppet-e56406f15086eb483c00a2904d8a75518412a905.tar.gz
puppet-e56406f15086eb483c00a2904d8a75518412a905.tar.xz
puppet-e56406f15086eb483c00a2904d8a75518412a905.zip
Implementing listening state tracking for webrick and mongrel.
Diffstat (limited to 'spec/unit/network/http/webrick.rb')
-rw-r--r--spec/unit/network/http/webrick.rb22
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/unit/network/http/webrick.rb b/spec/unit/network/http/webrick.rb
index d162288fc..f414ca11d 100644
--- a/spec/unit/network/http/webrick.rb
+++ b/spec/unit/network/http/webrick.rb
@@ -6,13 +6,19 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
require 'puppet/network/http'
+describe Puppet::Network::HTTP::WEBRick, "after initializing" do
+ it "should not be listening" do
+ Puppet::Network::HTTP::WEBRick.new.should_not be_listening
+ end
+end
+
describe Puppet::Network::HTTP::WEBRick, "when turning on listening" do
before do
@server = Puppet::Network::HTTP::WEBRick.new
+ Puppet.stubs(:start)
end
it "should fail if already listening" do
- Puppet.stubs(:start)
@server.listen(:foo => :bar)
Proc.new { @server.listen(:foo => :bar) }.should raise_error(RuntimeError)
end
@@ -25,6 +31,11 @@ describe Puppet::Network::HTTP::WEBRick, "when turning on listening" do
Puppet.expects(:start)
@server.listen(:foo => :bar)
end
+
+ it "should be listening" do
+ @server.listen(:foo => :bar)
+ @server.should be_listening
+ end
it "should instantiate a specific handler (webrick+rest, e.g.) for each handler, for each protocol being served (xmlrpc, rest, etc.)"
it "should mount handlers on a webrick path"
@@ -36,6 +47,8 @@ end
describe Puppet::Network::HTTP::WEBRick, "when turning off listening" do
before do
@server = Puppet::Network::HTTP::WEBRick.new
+ @server.stubs(:shutdown)
+ Puppet.stubs(:start).returns(true)
end
it "should fail unless listening" do
@@ -43,10 +56,15 @@ describe Puppet::Network::HTTP::WEBRick, "when turning off listening" do
end
it "should order webrick server to stop" do
- Puppet.stubs(:start).returns(true)
@server.should respond_to(:shutdown)
@server.expects(:shutdown)
@server.listen(:foo => :bar)
@server.unlisten
end
+
+ it "should no longer be listening" do
+ @server.listen(:foo => :bar)
+ @server.unlisten
+ @server.should_not be_listening
+ end
end