From 7ddbbe164d2621b0d5dbe9cfc98b686b0c320847 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Thu, 4 Sep 2014 17:17:14 -0700 Subject: Repair hacky use of rspec. --- lib/chef/rebooter.rb | 10 +--------- spec/functional/rebooter_spec.rb | 8 +++++--- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/chef/rebooter.rb b/lib/chef/rebooter.rb index f898a6430e..68fcb43201 100644 --- a/lib/chef/rebooter.rb +++ b/lib/chef/rebooter.rb @@ -37,7 +37,7 @@ class Chef end Chef::Log.warn "Shutdown command (not running): '#{cmd}'" - Sheller.shell_out!(cmd) + shell_out!(cmd) end def reboot_if_needed!(this_node) @@ -49,13 +49,5 @@ class Chef end end end # end class instance stuff. - - # this lets us stub #shell_out! in specs, while still calling the actual other functions. - class Sheller - # for ease of testing, we are not yet actually rebooting. - def self.shell_out!(cmd) - #shell_out!(cmd) - end - end end end diff --git a/spec/functional/rebooter_spec.rb b/spec/functional/rebooter_spec.rb index 3e87d4ee16..24356b90aa 100644 --- a/spec/functional/rebooter_spec.rb +++ b/spec/functional/rebooter_spec.rb @@ -43,21 +43,23 @@ describe Chef::Rebooter do let(:rebooter) { Chef::Rebooter } - let(:sheller) { Chef::Rebooter::Sheller } + let(:sheller) { Chef::Rebooter } describe '#reboot_if_needed!' do it 'should call #shell_out! when reboot has been requested' do run_context.request_reboot(reboot_info) - expect(sheller).to receive(:shell_out!).once + expect(rebooter).to receive(:shell_out!).once + expect(rebooter).to receive(:reboot_if_needed!).once.and_call_original rebooter.reboot_if_needed!(run_context.node) run_context.cancel_reboot end it 'should not call #shell_out! when reboot has not been requested' do - expect(sheller).to receive(:shell_out!).exactly(0).times + expect(rebooter).to receive(:shell_out!).exactly(0).times + expect(rebooter).to receive(:reboot_if_needed!).once.and_call_original rebooter.reboot_if_needed!(run_context.node) end end -- cgit v1.2.1