summaryrefslogtreecommitdiffstats
path: root/spec/unit/network
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-04-16 19:18:31 -0500
committerJames Turnbull <james@lovedthanlost.net>2009-04-22 16:07:06 +1000
commitf04a938084e0a68884af95378a3a9f81227c578f (patch)
treea82d78b7c25ed7c0c215caee0a0cc79c7bbb883f /spec/unit/network
parent6a51f6fb2184f25bf45a1328e0ba889aa066ffd3 (diff)
downloadpuppet-f04a938084e0a68884af95378a3a9f81227c578f.tar.gz
puppet-f04a938084e0a68884af95378a3a9f81227c578f.tar.xz
puppet-f04a938084e0a68884af95378a3a9f81227c578f.zip
Adding support for specifying a preferred serialization format
This isn't that great, but at least it provides basic tuning of the format. Also removing the catalog_format default, since it's no longer used. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/network')
-rwxr-xr-xspec/unit/network/format_handler.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/unit/network/format_handler.rb b/spec/unit/network/format_handler.rb
index 8d11583ef..54409b92a 100755
--- a/spec/unit/network/format_handler.rb
+++ b/spec/unit/network/format_handler.rb
@@ -49,6 +49,17 @@ describe Puppet::Network::FormatHandler do
FormatTester.supported_formats.should == [:four, :two, :three, :one]
end
+ it "should always put the preferred serialization format first if it is supported" do
+ one = stub 'supported', :supported? => true, :name => :one, :weight => 1
+ two = stub 'supported', :supported? => true, :name => :two, :weight => 6
+
+ Puppet.settings.expects(:value).with(:preferred_serialization_format).returns :one
+ Puppet::Network::FormatHandler.stubs(:formats).returns [:one, :two]
+ Puppet::Network::FormatHandler.stubs(:format).with(:one).returns one
+ Puppet::Network::FormatHandler.stubs(:format).with(:two).returns two
+ FormatTester.supported_formats.should == [:one, :two]
+ end
+
it "should return the first format as the default format" do
FormatTester.expects(:supported_formats).returns [:one, :two]
FormatTester.default_format.should == :one