2011-07-01 02:48:18 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
require 'guard/puppet'
|
|
|
|
|
|
|
|
describe Guard::Puppet do
|
|
|
|
let(:guard) { described_class.new }
|
|
|
|
|
|
|
|
describe '#run_all' do
|
|
|
|
before do
|
2011-07-01 03:56:32 +00:00
|
|
|
Guard::UI.stubs(:info)
|
2011-07-01 02:48:18 +00:00
|
|
|
Guard::Notifier.expects(:notify).with("Applying Puppet configuration...", { :image => :pending, :title => "Puppet Config" })
|
|
|
|
Guard::Puppet::Runner.any_instance.expects(:run).returns(return_value)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'fails' do
|
|
|
|
let(:return_value) { 1 }
|
|
|
|
|
|
|
|
it 'should show the failure message' do
|
|
|
|
Guard::Notifier.expects(:notify).with("Puppet config failure!", :image => :failed, :title => "Puppet Config")
|
|
|
|
guard.run_all
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'succeeds' do
|
|
|
|
let(:return_value) { 0 }
|
|
|
|
|
|
|
|
it 'should show the success message' do
|
|
|
|
Guard::Notifier.expects(:notify).with("Puppet config reapplied successfully!", :title => "Puppet Config")
|
|
|
|
guard.run_all
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|