diff options
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/file_content_management/tempfile_spec.rb | 8 |
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 |