summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsnehaldwivedi <sdwivedi@msystechnologies.com>2020-09-04 05:09:09 -0700
committersnehaldwivedi <sdwivedi@msystechnologies.com>2021-03-25 06:26:26 -0700
commitae6e49503da6708dfec8c66e62490fae3cad654b (patch)
treefc4dc79aa03eb8b29deb6e73200cf558b66c39eb
parent0d6843009cb56e42bd9a88227bb3b52ae3c5ac48 (diff)
downloadchef-ae6e49503da6708dfec8c66e62490fae3cad654b.tar.gz
Fixed test failing on windows for create clientsnehal/knife_client_create_should_check_file_permissions
Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
-rw-r--r--spec/unit/knife/client_create_spec.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/unit/knife/client_create_spec.rb b/spec/unit/knife/client_create_spec.rb
index d8b67de101..4f7f6dc3a5 100644
--- a/spec/unit/knife/client_create_spec.rb
+++ b/spec/unit/knife/client_create_spec.rb
@@ -122,10 +122,12 @@ describe Chef::Knife::ClientCreate do
end
it "should write the private key to a file" do
- knife.config[:file] = "/tmp/monkeypants"
+ file = Tempfile.new
+ file_path = file.path
+ knife.config[:file] = file_path
filehandle = double("Filehandle")
expect(filehandle).to receive(:print).with("woot")
- expect(File).to receive(:open).with("/tmp/monkeypants", "w").and_yield(filehandle)
+ expect(File).to receive(:open).with(file_path, "w").and_yield(filehandle)
knife.run
end
end