diff --git a/spec/unit/knife/core/windows_bootstrap_context_spec.rb b/spec/unit/knife/core/windows_bootstrap_context_spec.rb index afc42c95..91ec97af 100644 --- a/spec/unit/knife/core/windows_bootstrap_context_spec.rb +++ b/spec/unit/knife/core/windows_bootstrap_context_spec.rb @@ -23,6 +23,14 @@ let(:chef_config) { Chef::Config.save } # "dup" to a hash let(:bootstrap_context) { Chef::Knife::Core::WindowsBootstrapContext.new(config, nil, chef_config, nil) } + before do + # Stub path methods to return consistent values across all platforms. + # On actual Windows (e.g. windows-2025 CI), these methods may resolve + # to a different drive letter based on the gem installation path. + allow(ChefConfig::Config).to receive(:etc_chef_dir).with(windows: true).and_return("C:\\chef") + allow(ChefConfig::Config).to receive(:c_opscode_dir).and_return("C:\\opscode\\chef") + end + describe "fips" do context "when fips is set" do before do