diff options
| author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-02-13 11:14:26 -0800 |
|---|---|---|
| committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-02-13 11:14:26 -0800 |
| commit | ffb063c74263ef04440e7887e5265f1c58844890 (patch) | |
| tree | 3011c0192911cd61b79320310020bb6f0841c1fb /spec | |
| parent | 5df73f6fa1c607bf0cf6d1e2f09b533a4106c164 (diff) | |
| download | chef-ffb063c74263ef04440e7887e5265f1c58844890.tar.gz | |
add spec
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/unit/provider/remote_file/http_spec.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/spec/unit/provider/remote_file/http_spec.rb b/spec/unit/provider/remote_file/http_spec.rb index ec9c0cf2e3..e1f74bd35a 100644 --- a/spec/unit/provider/remote_file/http_spec.rb +++ b/spec/unit/provider/remote_file/http_spec.rb @@ -185,14 +185,12 @@ describe Chef::Provider::RemoteFile::HTTP do expect(Chef::HTTP::Simple).to receive(:new).with(*expected_http_args).and_return(rest) end - describe "and the request does not return new content" do - - it "should return a nil tempfile for a 304 HTTPNotModifed" do - # Streaming request returns nil for 304 errors - expect(rest).to receive(:streaming_request).with(uri, {}, tempfile).and_return(nil) - expect(fetcher.fetch).to be_nil - end - + it "should clean up the tempfile, and return a nil when streaming_request returns nil" do + # Streaming request returns nil for a 304 not modified (etags / last-modified) + expect(rest).to receive(:streaming_request).with(uri, {}, tempfile).and_return(nil) + expect(tempfile).to receive(:close) + expect(tempfile).to receive(:unlink) + expect(fetcher.fetch).to be_nil end context "with progress reports" do |
