summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2020-08-25 17:51:42 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2020-08-25 17:51:42 -0700
commit238a4cb9baf9728ee9076ceefcfb6324960a0262 (patch)
tree44817e6d5fa36015548f3f1248e89efd7b822693
parentcf74fad25b978b400226c616d4cc70cd21374a34 (diff)
downloadohai-lcg/chef-utils-helpers.tar.gz
Try to fix windows unitslcg/chef-utils-helpers
This throws warnings, but I'm a bit out of ideas today. This lies like crazy to make it work on windows. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--spec/unit/mixin/which_spec.rb (renamed from spec/unit/util/file_helper_spec.rb)11
1 files changed, 6 insertions, 5 deletions
diff --git a/spec/unit/util/file_helper_spec.rb b/spec/unit/mixin/which_spec.rb
index 8fc542f0..d6236757 100644
--- a/spec/unit/util/file_helper_spec.rb
+++ b/spec/unit/mixin/which_spec.rb
@@ -1,6 +1,6 @@
# Author:: Bryan McLellan <btm@loftninjas.org>
#
-# Copyright:: Copyright (c) 2014-2016 Chef Software, Inc.
+# Copyright:: Copyright (c) Chef Software Inc.
#
# License:: Apache License, Version 2.0
#
@@ -17,26 +17,27 @@
# limitations under the License.
require "spec_helper"
-require "ohai/util/file_helper"
class FileHelperMock
- include Ohai::Util::FileHelper
+ include Ohai::Mixin::Which
end
-describe "Ohai::Util::FileHelper" do
+describe "Ohai::Mixin::Which" do
let(:file_helper) { FileHelperMock.new }
before do
+ old_env = ENV
+ ENV["Path"] = ENV["PATH"] = "/usr/bin"
allow(file_helper).to receive(:name).and_return("Fakeclass")
logger = instance_double("Mixlib::Log::Child", trace: nil, debug: nil, warn: nil)
allow(file_helper).to receive(:logger).and_return(logger)
allow(File).to receive(:executable?).and_return(false)
+ ENV = old_env
end
describe "which" do
it "returns the path to an executable that is in the path" do
allow(File).to receive(:executable?).with("/usr/bin/skyhawk").and_return(true)
-
expect(file_helper.which("skyhawk")).to eql "/usr/bin/skyhawk"
end