summaryrefslogtreecommitdiffstats
path: root/spec/unit/network/client.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-03-25 18:18:34 -0500
committerLuke Kanies <luke@madstop.com>2008-03-25 18:18:34 -0500
commita8592f1009040ebf30a98268610915cc33bb3f63 (patch)
tree49f61323a8536d58ce332e97b882677f55727df7 /spec/unit/network/client.rb
parente1907798425a7b163ac1b831b0cf11e88985815e (diff)
parent491a69682728818e04b8a20a5d8f4f783ad6ddaf (diff)
downloadpuppet-a8592f1009040ebf30a98268610915cc33bb3f63.tar.gz
puppet-a8592f1009040ebf30a98268610915cc33bb3f63.tar.xz
puppet-a8592f1009040ebf30a98268610915cc33bb3f63.zip
Merge branch '0.24.x'
Conflicts: install.rb lib/puppet/defaults.rb man/man8/puppet.8
Diffstat (limited to 'spec/unit/network/client.rb')
-rw-r--r--spec/unit/network/client.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/unit/network/client.rb b/spec/unit/network/client.rb
new file mode 100644
index 000000000..bc41efb4f
--- /dev/null
+++ b/spec/unit/network/client.rb
@@ -0,0 +1,43 @@
+#!/usr/bin/env ruby
+#
+# Created by Luke Kanies on 2008-3-24.
+# Copyright (c) 2008. All rights reserved.
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+require 'puppet/network/client'
+
+describe Puppet::Network::Client do
+ before do
+ Puppet::Network::HttpPool.stubs(:cert_setup)
+ end
+ describe "when keep-alive is enabled" do
+ before do
+ Puppet::Network::HttpPool.stubs(:keep_alive?).returns true
+ end
+ it "should start the http client up on creation" do
+ http = mock 'http'
+ http.stub_everything
+ http.expects(:start)
+ Net::HTTP.stubs(:new).returns http
+
+ # Pick a random subclass...
+ Puppet::Network::Client.master.new :Server => Puppet[:server]
+ end
+ end
+
+ describe "when keep-alive is disabled" do
+ before do
+ Puppet::Network::HttpPool.stubs(:keep_alive?).returns false
+ end
+ it "should not start the http client up on creation" do
+ http = mock 'http'
+ http.stub_everything
+ http.expects(:start).never
+ Net::HTTP.stubs(:new).returns http
+
+ # Pick a random subclass...
+ Puppet::Network::Client.master.new :Server => Puppet[:server]
+ end
+ end
+end