summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-01-27 14:18:13 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2017-01-27 14:18:13 -0800
commitb147c589a602411307b7abb1d2249ba5e43e188e (patch)
treec37e60bdc2d677a26e285144e094b73ad579d8b4
parente1361a3ab6879a9329e0dd02f4020fbc5b023ede (diff)
downloadmixlib-shellout-b147c589a602411307b7abb1d2249ba5e43e188e.tar.gz
de-utilification of specs
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--spec/mixlib/shellout/windows_spec.rb21
1 files changed, 10 insertions, 11 deletions
diff --git a/spec/mixlib/shellout/windows_spec.rb b/spec/mixlib/shellout/windows_spec.rb
index fe511eb..3402889 100644
--- a/spec/mixlib/shellout/windows_spec.rb
+++ b/spec/mixlib/shellout/windows_spec.rb
@@ -4,7 +4,7 @@ describe "Mixlib::ShellOut::Windows", :windows_only do
describe "Utils" do
describe ".should_run_under_cmd?" do
- subject { Mixlib::ShellOut::Windows::Utils.should_run_under_cmd?(command) }
+ subject { Mixlib::ShellOut.new.should_run_under_cmd?(command) }
def self.with_command(_command, &example)
context "with command: #{_command}" do
@@ -110,7 +110,7 @@ describe "Mixlib::ShellOut::Windows", :windows_only do
end
describe ".kill_process_tree" do
- let(:utils) { Mixlib::ShellOut::Windows::Utils }
+ let(:shell_out) { Mixlib::ShellOut.new }
let(:wmi) { Object.new }
let(:wmi_ole_object) { Object.new }
let(:wmi_process) { Object.new }
@@ -129,8 +129,8 @@ describe "Mixlib::ShellOut::Windows", :windows_only do
end
it "does not attempt to kill csrss.exe" do
- expect(utils).to_not receive(:kill_process)
- utils.kill_process_tree(200, wmi, logger)
+ expect(shell_out).to_not receive(:kill_process)
+ shell_out.kill_process_tree(200, wmi, logger)
end
end
@@ -141,10 +141,10 @@ describe "Mixlib::ShellOut::Windows", :windows_only do
end
it "does attempt to kill blah.exe" do
- expect(utils).to receive(:kill_process).with(wmi_process, logger)
- expect(utils).to receive(:kill_process_tree).with(200, wmi, logger).and_call_original
- expect(utils).to receive(:kill_process_tree).with(300, wmi, logger)
- utils.kill_process_tree(200, wmi, logger)
+ expect(shell_out).to receive(:kill_process).with(wmi_process, logger)
+ expect(shell_out).to receive(:kill_process_tree).with(200, wmi, logger).and_call_original
+ expect(shell_out).to receive(:kill_process_tree).with(300, wmi, logger)
+ shell_out.kill_process_tree(200, wmi, logger)
end
end
end
@@ -186,9 +186,8 @@ describe "Mixlib::ShellOut::Windows", :windows_only do
let(:stubbed_shell_out) { raise NotImplemented, "Must declare let(:stubbed_shell_out)" }
let(:shell_out) { Mixlib::ShellOut.new(cmd) }
- let(:utils) { Mixlib::ShellOut::Windows::Utils }
- let(:with_valid_exe_at_location) { lambda { |s| allow(utils).to receive(:find_executable).and_return(executable_path) } }
- let(:with_invalid_exe_at_location) { lambda { |s| allow(utils).to receive(:find_executable).and_return(nil) } }
+ let(:with_valid_exe_at_location) { lambda { |s| allow(shell_out).to receive(:find_executable).and_return(executable_path) } }
+ let(:with_invalid_exe_at_location) { lambda { |s| allow(shell_out).to receive(:find_executable).and_return(nil) } }
context "with empty command" do
let(:stubbed_shell_out) { shell_out }