Created
January 15, 2015 20:36
-
-
Save petems/4b9e31b6cddc878f2f71 to your computer and use it in GitHub Desktop.
Stopping stdlib validate_cmd from running in rspec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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