Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / defined_with_params_spec.rb
old mode 100755 (executable)
new mode 100644 (file)
index a332bd6..d8e5c8c
@@ -1,10 +1,8 @@
-#! /usr/bin/env ruby -S rspec
 require 'spec_helper_acceptance'
 
 describe 'defined_with_params function' do
   describe 'success' do
-    it 'should successfully notify' do
-      pp = <<-EOS
+    pp1 = <<-DOC
       user { 'dan':
         ensure => present,
       }
@@ -12,10 +10,29 @@ describe 'defined_with_params function' do
       if defined_with_params(User[dan], {'ensure' => 'present' }) {
         notify { 'User defined with ensure=>present': }
       }
-      EOS
+    DOC
+    it 'successfullies checks a type' do
+      apply_manifest(pp1, :catch_failures => true) do |r|
+        expect(r.stdout).to match(%r{Notice: User defined with ensure=>present})
+      end
+    end
+
+    pp2 = <<-DOC
+      class foo (
+        $bar,
+      ) {}
 
-      apply_manifest(pp, :catch_failures => true) do |r|
-        expect(r.stdout).to match(/Notice: User defined with ensure=>present/)
+      class { 'foo':
+        bar => 'baz',
+      }
+
+      if defined_with_params(Class[foo], { 'bar' => 'baz' }) {
+        notify { 'Class foo defined with bar=>baz': }
+      }
+    DOC
+    it 'successfullies checks a class' do
+      apply_manifest(pp2, :catch_failures => true) do |r|
+        expect(r.stdout).to match(%r{Notice: Class foo defined with bar=>baz})
       end
     end
   end