From 40ea2656f072e23bbbccd22c39fb29a36390fa3a Mon Sep 17 00:00:00 2001 From: Micah Date: Tue, 12 Jul 2016 16:46:08 -0400 Subject: git subrepo clone https://leap.se/git/puppet_stdlib puppet/modules/stdlib subrepo: subdir: "puppet/modules/stdlib" merged: "7112363" upstream: origin: "https://leap.se/git/puppet_stdlib" branch: "master" commit: "7112363" git-subrepo: version: "0.3.0" origin: "https://github.com/ingydotnet/git-subrepo" commit: "1e79595" Change-Id: I032e3e7c2984bf53b717373df495c039bb6f41b3 --- .../stdlib/spec/acceptance/validate_cmd_spec.rb | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 puppet/modules/stdlib/spec/acceptance/validate_cmd_spec.rb (limited to 'puppet/modules/stdlib/spec/acceptance/validate_cmd_spec.rb') diff --git a/puppet/modules/stdlib/spec/acceptance/validate_cmd_spec.rb b/puppet/modules/stdlib/spec/acceptance/validate_cmd_spec.rb new file mode 100755 index 00000000..5ac66fdb --- /dev/null +++ b/puppet/modules/stdlib/spec/acceptance/validate_cmd_spec.rb @@ -0,0 +1,52 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'validate_cmd function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + describe 'success' do + it 'validates a true command' do + pp = <<-EOS + $one = 'foo' + if $::osfamily == 'windows' { + $two = 'echo' #shell built-in + } else { + $two = '/bin/echo' + } + validate_cmd($one,$two) + EOS + + apply_manifest(pp, :catch_failures => true) + end + it 'validates a fail command' do + pp = <<-EOS + $one = 'foo' + if $::osfamily == 'windows' { + $two = 'C:/aoeu' + } else { + $two = '/bin/aoeu' + } + validate_cmd($one,$two) + EOS + + apply_manifest(pp, :expect_failures => true) + end + it 'validates a fail command with a custom error message' do + pp = <<-EOS + $one = 'foo' + if $::osfamily == 'windows' { + $two = 'C:/aoeu' + } else { + $two = '/bin/aoeu' + } + validate_cmd($one,$two,"aoeu is dvorak") + EOS + + apply_manifest(pp, :expect_failures => true) do |output| + expect(output.stderr).to match(/aoeu is dvorak/) + end + end + end + describe 'failure' do + it 'handles improper number of arguments' + it 'handles improper argument types' + end +end -- cgit v1.2.3