diff options
Diffstat (limited to 'spec/unit/dsl/reboot_pending_spec.rb')
-rw-r--r-- | spec/unit/dsl/reboot_pending_spec.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/spec/unit/dsl/reboot_pending_spec.rb b/spec/unit/dsl/reboot_pending_spec.rb index 42891195bf..66f8b76d7f 100644 --- a/spec/unit/dsl/reboot_pending_spec.rb +++ b/spec/unit/dsl/reboot_pending_spec.rb @@ -34,22 +34,22 @@ describe Chef::DSL::RebootPending do allow(recipe).to receive(:registry_key_exists?).and_return(false) allow(recipe).to receive(:registry_value_exists?).and_return(false) end - + it 'should return true if "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations" exists' do allow(recipe).to receive(:registry_value_exists?).with('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { :name => "PendingFileRenameOperations" }).and_return(true) expect(recipe.reboot_pending?).to be_truthy end - + it 'should return true if "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" exists' do allow(recipe).to receive(:registry_key_exists?).with('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired').and_return(true) expect(recipe.reboot_pending?).to be_truthy end - + it 'should return true if key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired" exists' do allow(recipe).to receive(:registry_key_exists?).with('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending').and_return(true) expect(recipe.reboot_pending?).to be_truthy end - + context "version is server 2003" do before do allow(Chef::Platform).to receive(:windows_server_2003?).and_return(true) @@ -58,22 +58,22 @@ describe Chef::DSL::RebootPending do it 'should return true if value "HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile" contains specific data on 2k3' do allow(recipe).to receive(:registry_key_exists?).with('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile').and_return(true) allow(recipe).to receive(:registry_get_values).with('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile').and_return( - [{:name => "Flags", :type => :dword, :data => 3}]) + [{ :name => "Flags", :type => :dword, :data => 3 }]) expect(recipe.reboot_pending?).to be_truthy end end end - + context "platform is ubuntu" do before do allow(recipe).to receive(:platform?).with("ubuntu").and_return(true) end - + it "should return true if /var/run/reboot-required exists" do allow(File).to receive(:exists?).with("/var/run/reboot-required").and_return(true) expect(recipe.reboot_pending?).to be_truthy end - + it "should return false if /var/run/reboot-required does not exist" do allow(File).to receive(:exists?).with("/var/run/reboot-required").and_return(false) expect(recipe.reboot_pending?).to be_falsey @@ -85,7 +85,7 @@ describe Chef::DSL::RebootPending do describe "in a recipe" do it "responds to reboot_pending?" do # Chef::Recipe.new(cookbook_name, recipe_name, run_context(node, cookbook_collection, events)) - recipe = Chef::Recipe.new(nil,nil,Chef::RunContext.new(Chef::Node.new, {}, nil)) + recipe = Chef::Recipe.new(nil, nil, Chef::RunContext.new(Chef::Node.new, {}, nil)) expect(recipe).to respond_to(:reboot_pending?) end end # describe in a recipe |