summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCrae <john.mccrae@progress.com>2022-10-05 11:10:26 +0000
committerJohn McCrae <john.mccrae@progress.com>2022-10-05 11:10:26 +0000
commit5fb97d22f91349d40f37d77df8f7d39f4313268e (patch)
tree23c5b9b93e4249070bb397ee194ff01fcbfb4bfb
parent00d1e47ac2ad7a55335ace7e77d313aa23329bd8 (diff)
downloadchef-jfm/correcting_tempfile_creation.tar.gz
refactored tests to use updated verbsjfm/correcting_tempfile_creation
Signed-off-by: John McCrae <john.mccrae@progress.com>
-rw-r--r--spec/unit/file_content_management/tempfile_spec.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/spec/unit/file_content_management/tempfile_spec.rb b/spec/unit/file_content_management/tempfile_spec.rb
index 6dbc3df91e..fff7bca922 100644
--- a/spec/unit/file_content_management/tempfile_spec.rb
+++ b/spec/unit/file_content_management/tempfile_spec.rb
@@ -18,6 +18,8 @@
require "spec_helper"
+require "pry"
+
describe Chef::FileContentManagement::Tempfile do
def tempfile_object_for_path(path)
@@ -100,15 +102,15 @@ describe Chef::FileContentManagement::Tempfile do
it "should pick the destdir preferentially" do
subject = tempfile_object_for_path("/foo/bar/new_file")
- expect(Tempfile).to receive(:open).with([tempname, ""], "/foo/bar").and_return(tempfile)
+ expect(Tempfile).to receive(:create).with([tempname, ""], "/foo/bar").and_return(tempfile)
subject.send(:tempfile_open)
end
it "should use ENV['TMP'] otherwise" do
subject = tempfile_object_for_path("/foo/bar/new_file")
expect(Dir).to receive(:tmpdir).and_return("/tmp/dir")
- expect(Tempfile).to receive(:open).with([tempname, ""], "/foo/bar").and_raise(SystemCallError, "foo")
- expect(Tempfile).to receive(:open).with([tempname, ""], "/tmp/dir").and_return(tempfile)
+ expect(Tempfile).to receive(:create).with([tempname, ""], "/foo/bar").and_raise(SystemCallError, "foo")
+ expect(Tempfile).to receive(:create).with([tempname, ""], "/tmp/dir").and_return(tempfile)
subject.send(:tempfile_open)
end
end