[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 2.6.5-303-gfcfa26a

Matt Robinson matt at puppetlabs.com
Thu Mar 17 10:48:31 UTC 2011


The following commit has been merged in the upstream branch:
commit 422399b47764e29055974ff5bad5dfcb982a8b74
Author: Matt Robinson <matt at puppetlabs.com>
Date:   Mon Feb 28 16:55:18 2011 -0800

    (#5466) Write specs for output of puppet resource
    
    Reviewed-by: Nick Lewis <nick at puppetlabs.com>

diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index ff31b24..eaa3d55 100755
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -99,11 +99,11 @@ describe Puppet::Resource do
   end
 
   it 'should fail if strict is set and type does not exist' do
-    lambda { Puppet::Resource.new('foo', 'title', {:strict=>true}) }.should raise_error(ArgumentError, 'Invalid resource type foo') 
+    lambda { Puppet::Resource.new('foo', 'title', {:strict=>true}) }.should raise_error(ArgumentError, 'Invalid resource type foo')
   end
 
   it 'should fail if strict is set and class does not exist' do
-    lambda { Puppet::Resource.new('Class', 'foo', {:strict=>true}) }.should raise_error(ArgumentError, 'Could not find declared class foo') 
+    lambda { Puppet::Resource.new('Class', 'foo', {:strict=>true}) }.should raise_error(ArgumentError, 'Could not find declared class foo')
   end
 
   it "should fail if the title is a hash and the type is not a valid resource reference string" do
@@ -486,19 +486,23 @@ describe Puppet::Resource do
 
   describe "when converting to puppet code" do
     before do
-      @resource = Puppet::Resource.new("one::two", "/my/file", :parameters => {:noop => true, :foo => %w{one two}})
-    end
-
-    it "should print the type and title" do
-      @resource.to_manifest.should be_include("one::two { '/my/file':\n")
-    end
-
-    it "should print each parameter, with the value single-quoted" do
-      @resource.to_manifest.should be_include("    noop => 'true'")
+      @resource = Puppet::Resource.new("one::two", "/my/file",
+        :parameters => {
+          :noop => true,
+          :foo => %w{one two},
+          :ensure => 'present',
+        }
+      )
     end
 
-    it "should print array values appropriately" do
-      @resource.to_manifest.should be_include("    foo => ['one','two']")
+    it "should align, sort and add trailing commas to attributes with ensure first" do
+      @resource.to_manifest.should == <<-HEREDOC.gsub(/^\s{8}/, '').gsub(/\n$/, '')
+        one::two { '/my/file':
+          ensure => 'present',
+          foo    => ['one', 'two'],
+          noop   => 'true',
+        }
+      HEREDOC
     end
   end
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list