summaryrefslogtreecommitdiffstats
path: root/spec/unit/network/http/webrick.rb
diff options
context:
space:
mode:
authorRick Bradley <rick@rickbradley.com>2007-10-15 14:47:25 -0500
committerRick Bradley <rick@rickbradley.com>2007-10-15 14:47:25 -0500
commitc34efbccf1eec9957253d4fcdcb4ea9c79837ad8 (patch)
treeae04acf64b2b2a772c9d7d113fccf994fc6c71a3 /spec/unit/network/http/webrick.rb
parent9a179ec3a9df62c6179e7151831c4f07197cfbce (diff)
downloadpuppet-c34efbccf1eec9957253d4fcdcb4ea9c79837ad8.tar.gz
puppet-c34efbccf1eec9957253d4fcdcb4ea9c79837ad8.tar.xz
puppet-c34efbccf1eec9957253d4fcdcb4ea9c79837ad8.zip
Hooking up address/port support for the various servers w/ specs. Still need to start up a webrick server w/ address + port (this is far too incestuous with Puppet lib & Puppet.start at the moment).
Diffstat (limited to 'spec/unit/network/http/webrick.rb')
-rw-r--r--spec/unit/network/http/webrick.rb29
1 files changed, 19 insertions, 10 deletions
diff --git a/spec/unit/network/http/webrick.rb b/spec/unit/network/http/webrick.rb
index b070ec0d6..9ab97e831 100644
--- a/spec/unit/network/http/webrick.rb
+++ b/spec/unit/network/http/webrick.rb
@@ -15,39 +15,48 @@ end
describe Puppet::Network::HTTP::WEBrick, "when turning on listening" do
before do
@server = Puppet::Network::HTTP::WEBrick.new
+ @listen_params = { :address => "127.0.0.1", :port => 31337, :handlers => { :foo => :bar }}
Puppet.stubs(:start)
end
it "should fail if already listening" do
- @server.listen(:foo => :bar)
- Proc.new { @server.listen(:foo => :bar) }.should raise_error(RuntimeError)
+ @server.listen(@listen_params)
+ Proc.new { @server.listen(@listen_params) }.should raise_error(RuntimeError)
end
it "should require at least one handler" do
- Proc.new { @server.listen }.should raise_error(ArgumentError)
+ Proc.new { @server.listen(@listen_params.delete_if {|k,v| :handlers == k}) }.should raise_error(ArgumentError)
end
+ it "should require a listening address to be specified" do
+ Proc.new { @server.listen(@listen_params.delete_if {|k,v| :address == k})}.should raise_error(ArgumentError)
+ end
+
+ it "should require a listening port to be specified" do
+ Proc.new { @server.listen(@listen_params.delete_if {|k,v| :port == k})}.should raise_error(ArgumentError)
+ end
+
it "should order a webrick server to start" do
Puppet.expects(:start)
- @server.listen(:foo => :bar)
+ @server.listen(@listen_params)
end
+ it "should tell webrick to listen on the specified address and port"
+
it "should be listening" do
- @server.listen(:foo => :bar)
+ @server.listen(@listen_params)
@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"
-
- 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
@server.stubs(:shutdown)
+ @listen_params = { :address => "127.0.0.1", :port => 31337, :handlers => { :foo => :bar }}
Puppet.stubs(:start).returns(true)
end
@@ -58,12 +67,12 @@ describe Puppet::Network::HTTP::WEBrick, "when turning off listening" do
it "should order webrick server to stop" do
@server.should respond_to(:shutdown)
@server.expects(:shutdown)
- @server.listen(:foo => :bar)
+ @server.listen(@listen_params)
@server.unlisten
end
it "should no longer be listening" do
- @server.listen(:foo => :bar)
+ @server.listen(@listen_params)
@server.unlisten
@server.should_not be_listening
end