summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorRick Bradley <rick@rickbradley.com>2007-10-16 00:14:02 -0500
committerRick Bradley <rick@rickbradley.com>2007-10-16 00:14:02 -0500
commitab4c7fa825e0d1f702adc215c7ff6d445d3b6559 (patch)
tree052d3b6e62a82f0954bd2befb49ceda32a2f2cb5 /spec
parent099c5469bf8fd6bf1e65be1a8192c14e584e49c3 (diff)
downloadpuppet-ab4c7fa825e0d1f702adc215c7ff6d445d3b6559.tar.gz
puppet-ab4c7fa825e0d1f702adc215c7ff6d445d3b6559.tar.xz
puppet-ab4c7fa825e0d1f702adc215c7ff6d445d3b6559.zip
Minor tweaks to make the ::Server initialization a bit more robust. Fail on unknown HTTP Server types; fail fast.
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/network/server.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/spec/unit/network/server.rb b/spec/unit/network/server.rb
index 528d47d0e..659eb1930 100644
--- a/spec/unit/network/server.rb
+++ b/spec/unit/network/server.rb
@@ -9,8 +9,8 @@ require 'puppet/network/server'
describe Puppet::Network::Server, "when initializing" do
before do
@mock_http_server_class = mock('http server class')
- Puppet::Network::HTTP.stubs(:server_class_by_type).returns(@mock_http_server_class)
Puppet.stubs(:[]).with(:servertype).returns(:suparserver)
+ Puppet::Network::HTTP.stubs(:server_class_by_type).returns(@mock_http_server_class)
end
it "should allow specifying a listening address" do
@@ -63,10 +63,14 @@ describe Puppet::Network::Server, "when initializing" do
end
it "should ask the Puppet::Network::HTTP class to fetch the proper HTTP server class" do
- mock_http_server_class = mock('http server class')
- Puppet::Network::HTTP.expects(:server_class_by_type).with(:suparserver).returns(mock_http_server_class)
+ Puppet::Network::HTTP.expects(:server_class_by_type).with(:suparserver).returns(@mock_http_server_class)
@server = Puppet::Network::Server.new(:address => "127.0.0.1", :port => 31337)
end
+
+ it "should fail if the HTTP server class is unknown" do
+ Puppet::Network::HTTP.stubs(:server_class_by_type).returns(nil)
+ Proc.new { Puppet::Network::Server.new(:address => "127.0.0.1", :port => 31337) }.should raise_error(ArgumentError)
+ end
it "should allow registering indirections" do
@server = Puppet::Network::Server.new(:address => "127.0.0.1", :port => 31337, :handlers => [ :foo, :bar, :baz])