X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Facceptance%2Fvalidate_augeas_spec.rb;h=9a59f38cb819dac09c51c62248dae940f7bcd30a;hb=6f656bd4265e3dab13b9af2bf96e9044322e9d8f;hp=71a4c84255530b857635de2a6a0883810844f452;hpb=ad88f67c13ae0f1a08936dad643f1e3509ab5f40;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/spec/acceptance/validate_augeas_spec.rb b/3rdparty/modules/stdlib/spec/acceptance/validate_augeas_spec.rb old mode 100755 new mode 100644 index 71a4c8425..9a59f38cb --- a/3rdparty/modules/stdlib/spec/acceptance/validate_augeas_spec.rb +++ b/3rdparty/modules/stdlib/spec/acceptance/validate_augeas_spec.rb @@ -1,59 +1,57 @@ -#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' -describe 'validate_augeas function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows')) do +describe 'validate_augeas function', :unless => (fact('osfamily') == 'windows') do describe 'prep' do it 'installs augeas for tests' end describe 'success' do - context 'valid inputs with no 3rd argument' do + context 'with valid inputs with no 3rd argument' do { 'root:x:0:0:root:/root:/bin/bash\n' => 'Passwd.lns', - 'proc /proc proc nodev,noexec,nosuid 0 0\n' => 'Fstab.lns' - }.each do |line,lens| - it "validates a single argument for #{lens}" do - pp = <<-EOS + 'proc /proc proc nodev,noexec,nosuid 0 0\n' => 'Fstab.lns', + }.each do |line, lens| + pp1 = <<-DOC $line = "#{line}" $lens = "#{lens}" validate_augeas($line, $lens) - EOS - - apply_manifest(pp, :catch_failures => true) + DOC + it "validates a single argument for #{lens}" do + apply_manifest(pp1, :catch_failures => true) end end end - context 'valid inputs with 3rd and 4th arguments' do - it "validates a restricted value" do - line = 'root:x:0:0:root:/root:/bin/barsh\n' - lens = 'Passwd.lns' - restriction = '$file/*[shell="/bin/barsh"]' - pp = <<-EOS + + context 'with valid inputs with 3rd and 4th arguments' do + line = 'root:x:0:0:root:/root:/bin/barsh\n' + lens = 'Passwd.lns' + restriction = '$file/*[shell="/bin/barsh"]' + pp2 = <<-DOC $line = "#{line}" $lens = "#{lens}" $restriction = ['#{restriction}'] validate_augeas($line, $lens, $restriction, "my custom failure message") - EOS - - expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/my custom failure message/) + DOC + it 'validates a restricted value' do + expect(apply_manifest(pp2, :expect_failures => true).stderr).to match(%r{my custom failure message}) end end - context 'invalid inputs' do + + context 'with invalid inputs' do { 'root:x:0:0:root' => 'Passwd.lns', - '127.0.1.1' => 'Hosts.lns' - }.each do |line,lens| - it "validates a single argument for #{lens}" do - pp = <<-EOS + '127.0.1.1' => 'Hosts.lns', + }.each do |line, lens| + pp3 = <<-DOC $line = "#{line}" $lens = "#{lens}" validate_augeas($line, $lens) - EOS - - apply_manifest(pp, :expect_failures => true) + DOC + it "validates a single argument for #{lens}" do + apply_manifest(pp3, :expect_failures => true) end end end - context 'garbage inputs' do + context 'with garbage inputs' do it 'raises an error on invalid inputs' end end