Skip to content

Instantly share code, notes, and snippets.

@petems
Created January 15, 2015 20:36
Show Gist options
  • Save petems/4b9e31b6cddc878f2f71 to your computer and use it in GitHub Desktop.
Save petems/4b9e31b6cddc878f2f71 to your computer and use it in GitHub Desktop.
Stopping stdlib validate_cmd from running in rspec
class validate_cmd_rspec {
file {'/etc/haproxy/haproxy.cfg':
ensure => present,
content => template('validate_cmd_rspec/etc/haproxy/haproxy.cfg.erb'),
}
if versioncmp($::puppetversion, '3.5') >= 0 {
File[$sudoers_user_file] { validate_cmd => '/usr/sbin/haproxy -f % -c', }
}
else {
validate_cmd(template('validate_cmd_rspec/etc/haproxy/haproxy.cfg.erb'), '/usr/sbin/haproxy -f % -c', 'Haproxy failed to validate haproxy content')
}
}
require 'spec_helper'
describe 'validate_cmd_rspec' do
describe "validate_cmd_rspec class stubbing out haproxy call" do
before(:each) do
Puppet::Util::Execution.stubs(:execute)
end
it { should compile.with_all_deps }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment