diff options
author | Tim Smith <tsmith@chef.io> | 2020-07-13 14:48:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-13 14:48:39 -0700 |
commit | 64cd8a278a7d0e8055ad18e8a4118644c3f2d1b4 (patch) | |
tree | 61c2ca11c71afca52dd87afc455380a3d6c8ae0d | |
parent | 1d7dc1708e634ec47afd6dba48bf1ef132acf82d (diff) | |
parent | 5a4b11abacfd3e50107f048e6a9910fc11bdb1ef (diff) | |
download | chef-64cd8a278a7d0e8055ad18e8a4118644c3f2d1b4.tar.gz |
Merge pull request #10150 from chef/fix-windows-test-warning
Fix two warnings in tests.
-rw-r--r-- | spec/unit/win32/security_spec.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/spec/unit/win32/security_spec.rb b/spec/unit/win32/security_spec.rb index d90951c3e2..ed4c033aa3 100644 --- a/spec/unit/win32/security_spec.rb +++ b/spec/unit/win32/security_spec.rb @@ -81,9 +81,10 @@ describe "Chef::Win32::Security", :windows_only do context "when the user has admin privileges" do it "returns true" do - allow(Chef::ReservedNames::Win32::Security).to receive(:open_current_process_token) - token = Chef::ReservedNames::Win32::Security.open_current_process_token + token = double(:process_token) allow(token).to receive_message_chain(:handle, :handle) + + allow(Chef::ReservedNames::Win32::Security).to receive(:open_current_process_token).and_return(token) allow(Chef::ReservedNames::Win32::Security).to receive(:get_token_information_elevation_type) allow(Chef::ReservedNames::Win32::Security).to receive(:GetTokenInformation).and_return(true) allow_any_instance_of(FFI::Buffer).to receive(:read_ulong).and_return(1) @@ -128,7 +129,7 @@ describe "Chef::Win32::Security", :windows_only do context "when FFI::LastError.error result is not ERROR_INSUFFICIENT_BUFFER and not NO_ERROR" do it "raises Chef::ReservedNames::Win32::Error.raise! exception" do expect(FFI::LastError).to receive(:error).and_return(123).at_least(:once) - expect { security_class.lookup_account_name "system" }.to raise_error + expect { security_class.lookup_account_name "system" }.to raise_error(Chef::Exceptions::Win32APIError) end end end |