diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 395d6863..8aa72d44 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -20,6 +20,10 @@ Module.clear_all_cache_with_timeout if Module.respond_to?(:clear_all_cache_with_timeout) end + require "awesome_spawn/spec_helper" + config.include AwesomeSpawn::SpecHelper, :uses_awesome_spawn => true + config.before(:each, :uses_awesome_spawn) { disable_spawning } + if ENV["CI"] config.after(:suite) do require_relative "coverage_helper" diff --git a/spec/util/miq-system_spec.rb b/spec/util/miq-system_spec.rb index fb32cfe8..d83605ad 100644 --- a/spec/util/miq-system_spec.rb +++ b/spec/util/miq-system_spec.rb @@ -42,7 +42,7 @@ end end - context ".disk_usage" do + context ".disk_usage", :uses_awesome_spawn => true do it "linux" do linux_df_output_bytes = < ["-T", "-P", "-l"]) - .and_return(double(:output => linux_df_output_bytes)) - expect(AwesomeSpawn).to receive(:run!) - .with("df", :params => ["-T", "-P", "-i", "-l"]) - .and_return(double(:output => linux_df_output_inodes)) - + stub_good_run!("df", :params => ["-T", "-P", "-l"], :output => linux_df_output_bytes) + stub_good_run!("df", :params => ["-T", "-P", "-i", "-l"], :output => linux_df_output_inodes) expect(described_class.disk_usage).to eq(expected) end @@ -206,10 +201,7 @@ ] stub_const("Sys::Platform::IMPL", :macosx) - expect(AwesomeSpawn) - .to receive(:run) - .with("df", {:params => ["-ki", "-l"]}) - .and_return(AwesomeSpawn::CommandResult.new("abcd", mac_df_output, "", 123, 0)) + stub_good_run!("df", :params => ["-ki", "-l"], :output => mac_df_output) expect(described_class.disk_usage).to eq(expected) end end