summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Doherty <cdoherty@getchef.com>2014-09-10 15:55:28 -0700
committerChris Doherty <cdoherty@getchef.com>2014-09-10 16:11:22 -0700
commit5a89eddcf1ac9e4fcdc634a31eca60218541f6f4 (patch)
treea82d57a694383970da2199547c2758b9d61ae8d0
parent549f629d1b23010ebd9dd811babca7f174fd6af1 (diff)
downloadchef-5a89eddcf1ac9e4fcdc634a31eca60218541f6f4.tar.gz
Spec fixes for Windows:
- Switch pwd environment variable depending on platform. - Hardcode the temp file name instead of using described_class: Windows doesn't like ':' in paths.
-rw-r--r--spec/unit/workstation_config_loader_spec.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/unit/workstation_config_loader_spec.rb b/spec/unit/workstation_config_loader_spec.rb
index 78313aec37..91b91ebbad 100644
--- a/spec/unit/workstation_config_loader_spec.rb
+++ b/spec/unit/workstation_config_loader_spec.rb
@@ -88,7 +88,12 @@ describe Chef::WorkstationConfigLoader do
let(:env_pwd) { "/path/to/cwd" }
before do
- env["PWD"] = env_pwd
+ if Chef::Platform.windows?
+ env["CD"] = env_pwd
+ else
+ env["PWD"] = env_pwd
+ end
+
allow(config_loader).to receive(:path_exists?).with("#{env_pwd}/.chef/knife.rb").and_return(true)
allow(File).to receive(:exist?).with("#{env_pwd}/.chef").and_return(true)
allow(File).to receive(:directory?).with("#{env_pwd}/.chef").and_return(true)
@@ -229,7 +234,8 @@ describe Chef::WorkstationConfigLoader do
let(:config_content) { "" }
let(:explicit_config_location) do
- t = Tempfile.new("#{described_class}-rspec-test")
+ # could use described_class, but remove all ':' from the path if so.
+ t = Tempfile.new("Chef::WorkstationConfigLoader-rspec-test")
t.print(config_content)
t.close
t.path