Skip to content

Commit

Permalink
fix windows which
Browse files Browse the repository at this point in the history
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
  • Loading branch information
lamont-granquist committed Oct 2, 2020
1 parent 8df6e53 commit 90d5758
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions spec/unit/mixin/which_spec.rb
Expand Up @@ -29,19 +29,16 @@ def transport_connection
let(:file_helper) { FileHelperMock.new }

before do
old_env = ENV
ENV["Path"] = ENV["PATH"] = "/usr/bin"
Ohai::Mixin::ChefUtilsWiring::PathCache.instance.path_cache = "/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)
allow(File).to receive(:directory?).with("/usr/bin/skyhawk").and_return(false)
expect(file_helper.which("skyhawk")).to eql "/usr/bin/skyhawk"
end

Expand Down

0 comments on commit 90d5758

Please sign in to comment.