Added modules
This commit is contained in:
parent
c53c931217
commit
59ec520742
646 changed files with 35182 additions and 0 deletions
50
modules/stdlib/spec/acceptance/validate_cmd_spec.rb
Executable file
50
modules/stdlib/spec/acceptance/validate_cmd_spec.rb
Executable file
|
@ -0,0 +1,50 @@
|
|||
#! /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
|
||||
|
||||
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/aoeu is dvorak/)
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper number of arguments'
|
||||
it 'handles improper argument types'
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue