[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1601-gf8c1b08
James Turnbull
james at lovedthanlost.net
Fri Jan 15 09:08:08 UTC 2010
The following commit has been merged in the upstream branch:
commit 5e5c8b5414a69d79830b79392f0addce245c6911
Author: Markus Roberts <Markus at reality.com>
Date: Mon Dec 21 09:12:24 2009 -0800
Fixing tests
Signed-off-by: Markus Roberts <Markus at reality.com>
diff --git a/spec/unit/application/puppet.rb b/spec/unit/application/puppet.rb
index f4d6065..7703bac 100755
--- a/spec/unit/application/puppet.rb
+++ b/spec/unit/application/puppet.rb
@@ -332,70 +332,51 @@ describe "Puppet" do
end
describe "the 'apply' command" do
- confine "PSON library is missing; cannot test applying catalogs" => Puppet.features.pson?
-
- before do
- #Puppet::Resource::Catalog.stubs(:pson_create).returns Puppet::Resource::Catalog.new
- PSON.stubs(:parse).returns Puppet::Resource::Catalog.new
- end
-
it "should read the catalog in from disk if a file name is provided" do
@puppet.options[:catalog] = "/my/catalog.pson"
-
File.expects(:read).with("/my/catalog.pson").returns "something"
-
+ Puppet::Resource::Catalog.stubs(:convert_from).with(:pson,'something').returns Puppet::Resource::Catalog.new
@puppet.apply
end
it "should read the catalog in from stdin if '-' is provided" do
@puppet.options[:catalog] = "-"
-
$stdin.expects(:read).returns "something"
-
+ Puppet::Resource::Catalog.stubs(:convert_from).with(:pson,'something').returns Puppet::Resource::Catalog.new
@puppet.apply
end
- it "should deserialize the catalog from pson" do
+ it "should deserialize the catalog from the default format" do
@puppet.options[:catalog] = "/my/catalog.pson"
-
- File.expects(:read).returns "something"
- PSON.expects(:parse).with("something").returns Puppet::Resource::Catalog.new
-
+ File.stubs(:read).with("/my/catalog.pson").returns "something"
+ Puppet::Resource::Catalog.stubs(:default_format).returns :rot13_piglatin
+ Puppet::Resource::Catalog.stubs(:convert_from).with(:rot13_piglatin,'something').returns Puppet::Resource::Catalog.new
@puppet.apply
end
it "should fail helpfully if deserializing fails" do
@puppet.options[:catalog] = "/my/catalog.pson"
-
- File.expects(:read).returns "something"
- PSON.expects(:parse).raises ArgumentError
-
+ File.stubs(:read).with("/my/catalog.pson").returns "something syntacically invalid"
lambda { @puppet.apply }.should raise_error(Puppet::Error)
end
it "should convert plain data structures into a catalog if deserialization does not do so" do
@puppet.options[:catalog] = "/my/catalog.pson"
-
- File.expects(:read).returns "something"
- PSON.expects(:parse).with("something").returns({:foo => "bar"})
+ File.stubs(:read).with("/my/catalog.pson").returns "something"
+ Puppet::Resource::Catalog.stubs(:convert_from).with(:pson,"something").returns({:foo => "bar"})
Puppet::Resource::Catalog.expects(:pson_create).with({:foo => "bar"}).returns(Puppet::Resource::Catalog.new)
-
@puppet.apply
end
it "should convert the catalog to a RAL catalog and use a Configurer instance to apply it" do
@puppet.options[:catalog] = "/my/catalog.pson"
-
- File.expects(:read).returns "something"
-
+ File.stubs(:read).with("/my/catalog.pson").returns "something"
catalog = Puppet::Resource::Catalog.new
- PSON.expects(:parse).returns catalog
-
+ Puppet::Resource::Catalog.stubs(:convert_from).with(:pson,'something').returns catalog
catalog.expects(:to_ral).returns "mycatalog"
configurer = stub 'configurer'
Puppet::Configurer.expects(:new).returns configurer
-
configurer.expects(:run).with(:catalog => "mycatalog")
@puppet.apply
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list