Created
November 6, 2015 15:21
-
-
Save danzilio/d755896a2e18a78ea293 to your computer and use it in GitHub Desktop.
This file contains 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 Puppet::Runner do | |
subject { Puppet::Runner.new context } | |
let(:expected_retval) { 0 } | |
before(:each) do | |
allow(status).to receive(:status).and_return expected_retval | |
end | |
context 'with a successful puppet run that had changes' do | |
let(:expected_retval) { 2 } | |
it 'should log a message at the info level' do | |
expect(subject.log).to receive(:info).with(/Running Puppet/) | |
expect(subject.log).to receive(:info).with(/The Puppet run succeeded with changes/) | |
expect(subject.run).to be nil | |
end | |
end | |
context 'with a puppet run that timed out' do | |
let(:expected_retval) { 1 } | |
let(:stdout) { 'err: Could not retrieve plugin: execution expired' } | |
it 'should fail with a timeout error' do | |
expect { subject.run }.to raise_error Puppet::Runner::Timeout, /timeout waiting for puppetmaster/ | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment