summaryrefslogtreecommitdiffstats
path: root/spec/unit/resource_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/resource_spec.rb')
-rwxr-xr-xspec/unit/resource_spec.rb30
1 files changed, 17 insertions, 13 deletions
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index 8b7bfc3e6..e5146f332 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