]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - 3rdparty/modules/concat/spec/acceptance/deprecation_warnings_spec.rb
upgrade to concat 2.0.0
[dsa-puppet.git] / 3rdparty / modules / concat / spec / acceptance / deprecation_warnings_spec.rb
diff --git a/3rdparty/modules/concat/spec/acceptance/deprecation_warnings_spec.rb b/3rdparty/modules/concat/spec/acceptance/deprecation_warnings_spec.rb
new file mode 100644 (file)
index 0000000..8a689a7
--- /dev/null
@@ -0,0 +1,44 @@
+require 'spec_helper_acceptance'
+
+describe 'deprecation warnings' do
+  basedir = default.tmpdir('concat')
+
+  shared_examples 'has_warning' do |pp, w|
+    it 'applies the manifest twice with a stderr regex' do
+      expect(apply_manifest(pp, :catch_failures => true).stderr).to match(/#{Regexp.escape(w)}/m)
+      expect(apply_manifest(pp, :catch_changes => true).stderr).to match(/#{Regexp.escape(w)}/m)
+    end
+  end
+
+  context 'concat force parameter' do
+    pp = <<-EOS
+      concat { '#{basedir}/file':
+        force => false,
+      }
+      concat::fragment { 'foo':
+        target  => '#{basedir}/file',
+        content => 'bar',
+      }
+    EOS
+    w = 'The $force parameter to concat is deprecated and has no effect.'
+
+    it_behaves_like 'has_warning', pp, w
+  end
+
+  context 'concat::fragment ensure parameter' do
+    context 'target file exists' do
+    pp = <<-EOS
+      concat { '#{basedir}/file':
+      }
+      concat::fragment { 'foo':
+        target  => '#{basedir}/file',
+        ensure  => false,
+        content => 'bar',
+      }
+    EOS
+    w = 'The $ensure parameter to concat::fragment is deprecated and has no effect.'
+
+    it_behaves_like 'has_warning', pp, w
+    end
+  end
+end