Update stdlib and concat to 6.1.0 both
[mirror/dsa-puppet.git] / 3rdparty / modules / concat / spec / acceptance / validation_spec.rb
index c35871b..7a3641a 100644 (file)
@@ -1,35 +1,27 @@
 require 'spec_helper_acceptance'
 
-describe 'concat validate_cmd parameter', :unless => (fact('kernel') != 'Linux') do
-  basedir = default.tmpdir('concat')
-  context '=> "/usr/bin/test -e %"' do
-    before(:all) do
-      pp = <<-EOS
-        file { '#{basedir}':
-          ensure => directory
-        }
-      EOS
+describe 'validation, concat validate_cmd parameter', if: ['debian', 'redhat', 'ubuntu'].include?(os[:family]) do
+  before(:all) do
+    @basedir = setup_test_directory
+  end
 
-      apply_manifest(pp)
-    end
-    pp = <<-EOS
-      concat { '#{basedir}/file':
+  context 'with "/usr/bin/test -e %"' do
+    let(:pp) do
+      <<-MANIFEST
+      concat { '#{@basedir}/file':
         validate_cmd => '/usr/bin/test -e %',
       }
       concat::fragment { 'content':
-        target  => '#{basedir}/file',
+        target  => '#{@basedir}/file',
         content => 'content',
       }
-    EOS
-
-    it 'applies the manifest twice with no stderr' do
-      apply_manifest(pp, :catch_failures => true)
-      apply_manifest(pp, :catch_changes => true)
+      MANIFEST
     end
 
-    describe file("#{basedir}/file") do
-      it { should be_file }
-      it { should contain 'content' }
+    it 'applies the manifest twice with no stderr' do
+      idempotent_apply(pp)
+      expect(file("#{@basedir}/file")).to be_file
+      expect(file("#{@basedir}/file").content).to contain 'content'
     end
   end
 end