summaryrefslogtreecommitdiffstats
path: root/spec/unit/network/http_spec.rb
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-06-23 15:51:08 -0700
committerMarkus Roberts <Markus@reality.com>2010-06-23 22:27:29 -0700
commit51b70c05167399eb2274fc1add18b6b18d31429d (patch)
tree1a33b11f0f589d6f5cd806d6da9de317887ca0e6 /spec/unit/network/http_spec.rb
parent9958c805dd90acadbb56ed3095e665d8afa990cd (diff)
downloadpuppet-51b70c05167399eb2274fc1add18b6b18d31429d.tar.gz
puppet-51b70c05167399eb2274fc1add18b6b18d31429d.tar.xz
puppet-51b70c05167399eb2274fc1add18b6b18d31429d.zip
[#3994] rename the specs to have _spec.rb at the end
Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700
Diffstat (limited to 'spec/unit/network/http_spec.rb')
-rwxr-xr-xspec/unit/network/http_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/unit/network/http_spec.rb b/spec/unit/network/http_spec.rb
new file mode 100755
index 000000000..220726788
--- /dev/null
+++ b/spec/unit/network/http_spec.rb
@@ -0,0 +1,35 @@
+#!/usr/bin/env ruby
+#
+# Created by Rick Bradley on 2007-10-03.
+# Copyright (c) 2007. All rights reserved.
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+require 'puppet/network/http'
+
+describe Puppet::Network::HTTP do
+ it "should return the webrick HTTP server class when asked for a webrick server" do
+ Puppet::Network::HTTP.server_class_by_type(:webrick).should be(Puppet::Network::HTTP::WEBrick)
+ end
+
+ describe "when asked for a mongrel server" do
+ if Puppet.features.mongrel?
+ it "should return the mongrel server class" do
+ Puppet::Network::HTTP.server_class_by_type(:mongrel).should be(Puppet::Network::HTTP::Mongrel)
+ end
+ else
+ it "should fail" do
+ lambda { Puppet::Network::HTTP.server_class_by_type(:mongrel) }.should raise_error(ArgumentError)
+ end
+ end
+ end
+
+ it "should fail to return the mongrel HTTP server class if mongrel is not available " do
+ Puppet.features.expects(:mongrel?).returns(false)
+ Proc.new { Puppet::Network::HTTP.server_class_by_type(:mongrel) }.should raise_error(ArgumentError)
+ end
+
+ it "should return an error when asked for an unknown server" do
+ Proc.new { Puppet::Network::HTTP.server_class_by_type :foo }.should raise_error(ArgumentError)
+ end
+end