diff options
| author | Rick Bradley <rick@rickbradley.com> | 2007-10-15 12:04:30 -0500 |
|---|---|---|
| committer | Rick Bradley <rick@rickbradley.com> | 2007-10-15 12:04:30 -0500 |
| commit | ec71e05a162ec299982b90707cc16231c608997b (patch) | |
| tree | c16376f369f5ad880b17f47888c9cea33a9008bb /spec/unit/network/http/webrick.rb | |
| parent | 31384fea2263d9ee0e65312b4a0b956436022e63 (diff) | |
| download | puppet-ec71e05a162ec299982b90707cc16231c608997b.tar.gz puppet-ec71e05a162ec299982b90707cc16231c608997b.tar.xz puppet-ec71e05a162ec299982b90707cc16231c608997b.zip | |
More unit specs for mongrel and webrick; more code to make them work, yo.
Diffstat (limited to 'spec/unit/network/http/webrick.rb')
| -rw-r--r-- | spec/unit/network/http/webrick.rb | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/spec/unit/network/http/webrick.rb b/spec/unit/network/http/webrick.rb new file mode 100644 index 000000000..d162288fc --- /dev/null +++ b/spec/unit/network/http/webrick.rb @@ -0,0 +1,52 @@ +#!/usr/bin/env ruby +# +# Created by Rick Bradley on 2007-10-15. +# Copyright (c) 2007. All rights reserved. + +require File.dirname(__FILE__) + '/../../../spec_helper' +require 'puppet/network/http' + +describe Puppet::Network::HTTP::WEBRick, "when turning on listening" do + before do + @server = Puppet::Network::HTTP::WEBRick.new + 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 + + it "should require at least one handler" do + Proc.new { @server.listen }.should raise_error(ArgumentError) + end + + it "should order a webrick server to start" do + Puppet.expects(:start) + @server.listen(:foo => :bar) + 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" + + it "should be able to specify the address on which webrick will listen" + it "should be able to specify the port on which webrick will listen" +end + +describe Puppet::Network::HTTP::WEBRick, "when turning off listening" do + before do + @server = Puppet::Network::HTTP::WEBRick.new + end + + it "should fail unless listening" do + Proc.new { @server.unlisten }.should raise_error(RuntimeError) + 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 +end |
