From 34e02d2527969f3d40cfe338f4c5dbf4fd9aa124 Mon Sep 17 00:00:00 2001 From: John McCrae Date: Wed, 6 Apr 2022 09:36:34 -0700 Subject: Updating For Ruby 3.1 Signed-off-by: John McCrae --- spec/unit/mixin/shell_out_spec.rb | 9 +++++++-- spec/unit/plugins/azure_spec.rb | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'spec') diff --git a/spec/unit/mixin/shell_out_spec.rb b/spec/unit/mixin/shell_out_spec.rb index 7d08d9ff..0cf5baea 100644 --- a/spec/unit/mixin/shell_out_spec.rb +++ b/spec/unit/mixin/shell_out_spec.rb @@ -17,6 +17,7 @@ # require "spec_helper" +require "pry" describe Ohai::Mixin::ShellOut, "shell_out" do let(:cmd) { "sparkle-dream --version" } @@ -63,14 +64,14 @@ describe Ohai::Mixin::ShellOut, "shell_out" do let(:instance) { DummyPlugin.new } - before do + before(:each) do allow(instance).to receive(:logger).and_return(logger) allow(instance).to receive(:name).and_return(plugin_name) @original_env = ENV.to_hash ENV.clear end - after do + after(:each) do ENV.clear ENV.update(@original_env) end @@ -88,6 +89,10 @@ describe Ohai::Mixin::ShellOut, "shell_out" do describe "when the command does not exist" do it "logs the command and error message" do + require "pry" + Pry.config.input = STDIN + Pry.config.output = STDOUT + binding.pry expect(Mixlib::ShellOut).to receive(:new).with(cmd, options).and_return(shell_out) expect(shell_out).to receive(:run_command).and_raise(Errno::ENOENT, "sparkle-dream") expect(logger).to receive(:trace) diff --git a/spec/unit/plugins/azure_spec.rb b/spec/unit/plugins/azure_spec.rb index 4d875e80..0d9353d8 100644 --- a/spec/unit/plugins/azure_spec.rb +++ b/spec/unit/plugins/azure_spec.rb @@ -17,6 +17,7 @@ # require "spec_helper" +require "win32/registry" unless defined?(Win32::Registry) describe Ohai::System, "plugin azure" do let(:plugin) { get_plugin("azure") } -- cgit v1.2.1