summaryrefslogtreecommitdiff
path: root/spec/unit/provider/remote_file
diff options
context:
space:
mode:
authorsersut <serdar@opscode.com>2013-06-03 13:29:08 -0700
committersersut <serdar@opscode.com>2013-06-03 13:30:09 -0700
commitc1aba2676136a81da712f7772d020ed253b89392 (patch)
tree25cadebd7653eced1c641ddb360bce5769ffe3e9 /spec/unit/provider/remote_file
parent7fee9a0121fc56228a0214390b521a11894ef601 (diff)
downloadchef-c1aba2676136a81da712f7772d020ed253b89392.tar.gz
Remove unused class RemoteFile::Result.
Diffstat (limited to 'spec/unit/provider/remote_file')
-rw-r--r--spec/unit/provider/remote_file/content_spec.rb24
-rw-r--r--spec/unit/provider/remote_file/ftp_spec.rb4
-rw-r--r--spec/unit/provider/remote_file/http_spec.rb27
-rw-r--r--spec/unit/provider/remote_file/local_file_spec.rb4
4 files changed, 16 insertions, 43 deletions
diff --git a/spec/unit/provider/remote_file/content_spec.rb b/spec/unit/provider/remote_file/content_spec.rb
index ed02fa9a32..36ecfe1c8d 100644
--- a/spec/unit/provider/remote_file/content_spec.rb
+++ b/spec/unit/provider/remote_file/content_spec.rb
@@ -84,32 +84,20 @@ describe Chef::Provider::RemoteFile::Content do
describe "when the fetcher returns nil for the tempfile" do
before do
- @result = mock("Chef::Provider::RemoteFile::Result", :raw_file => nil, :etag => nil, :mtime => nil)
- http_fetcher = mock("Chef::Provider::RemoteFile::HTTP", :fetch => @result)
+ http_fetcher = mock("Chef::Provider::RemoteFile::HTTP", :fetch => nil)
Chef::Provider::RemoteFile::Fetcher.should_receive(:for_resource).with(@uri, new_resource, current_resource).and_return(http_fetcher)
end
it "should return nil for the tempfile" do
content.tempfile.should be_nil
end
-
- it "should not set the etags on the new resource" do
- new_resource.should_not_receive(:etag).with(@result.etag)
- content.tempfile
- end
-
- it "should not set the mtime on the new resource" do
- new_resource.should_not_receive(:mtime).with(@result.mtime)
- content.tempfile
- end
end
- describe "when the fetcher returns a result with a valid tempfile" do
+ describe "when the fetcher returns a valid tempfile" do
let(:mtime) { Time.now }
let(:tempfile) { mock("Tempfile") }
- let(:result) { Chef::Provider::RemoteFile::Result.new(tempfile, "etag", mtime) }
- let(:http_fetcher) { mock("Chef::Provider::RemoteFile::HTTP", :fetch => result) }
+ let(:http_fetcher) { mock("Chef::Provider::RemoteFile::HTTP", :fetch => tempfile) }
before do
Chef::Provider::RemoteFile::Fetcher.should_receive(:for_resource).with(@uri, new_resource, current_resource).and_return(http_fetcher)
@@ -189,8 +177,7 @@ describe Chef::Provider::RemoteFile::Content do
before do
@tempfile = mock("Tempfile")
mtime = Time.now
- @result = mock("Chef::Provider::RemoteFile::Result", :raw_file => @tempfile, :etag => "etag", :mtime => mtime)
- http_fetcher_works = mock("Chef::Provider::RemoteFile::HTTP", :fetch => @result)
+ http_fetcher_works = mock("Chef::Provider::RemoteFile::HTTP", :fetch => @tempfile)
Chef::Provider::RemoteFile::Fetcher.should_receive(:for_resource).with(@uri1, new_resource, current_resource).and_return(http_fetcher_works)
end
@@ -225,8 +212,7 @@ describe Chef::Provider::RemoteFile::Content do
URI.should_not_receive(:parse).with(new_resource.source[1])
@tempfile = mock("Tempfile")
mtime = Time.now
- @result = mock("Chef::Provider::RemoteFile::Result", :raw_file => @tempfile, :etag => "etag", :mtime => mtime)
- http_fetcher_works = mock("Chef::Provider::RemoteFile::HTTP", :fetch => @result)
+ http_fetcher_works = mock("Chef::Provider::RemoteFile::HTTP", :fetch => @tempfile)
Chef::Provider::RemoteFile::Fetcher.should_receive(:for_resource).with(@uri0, new_resource, current_resource).and_return(http_fetcher_works)
end
diff --git a/spec/unit/provider/remote_file/ftp_spec.rb b/spec/unit/provider/remote_file/ftp_spec.rb
index 2d2e9d34cb..4022fb25d3 100644
--- a/spec/unit/provider/remote_file/ftp_spec.rb
+++ b/spec/unit/provider/remote_file/ftp_spec.rb
@@ -193,7 +193,7 @@ describe Chef::Provider::RemoteFile::FTP do
it "should return a tempfile in the result" do
result = fetcher.fetch
- result.raw_file.should equal(tempfile)
+ result.should equal(tempfile)
end
end
@@ -215,7 +215,7 @@ describe Chef::Provider::RemoteFile::FTP do
ENV.should_receive(:[]=).with("SOCKS_SERVER", "socks5://bill:ted@socks.example.com:5000").ordered
ENV.should_receive(:[]=).with("SOCKS_SERVER", current_socks_server).ordered
result = fetcher.fetch
- result.raw_file.should equal(tempfile)
+ result.should equal(tempfile)
end
end
diff --git a/spec/unit/provider/remote_file/http_spec.rb b/spec/unit/provider/remote_file/http_spec.rb
index 43e3361f5e..6ae19327eb 100644
--- a/spec/unit/provider/remote_file/http_spec.rb
+++ b/spec/unit/provider/remote_file/http_spec.rb
@@ -200,7 +200,7 @@ describe Chef::Provider::RemoteFile::HTTP do
e = Net::HTTPRetriableError.new("304", r)
rest.stub!(:streaming_request).and_raise(e)
result = fetcher.fetch
- result.raw_file.should be_nil
+ result.should be_nil
end
end
@@ -214,10 +214,9 @@ describe Chef::Provider::RemoteFile::HTTP do
Chef::Digester.should_receive(:checksum_for_file).with(tempfile_path).and_return(fetched_content_checksum)
end
- it "should return a result" do
+ it "should return a tempfile" do
result = fetcher.fetch
- result.should be_a_kind_of(Chef::Provider::RemoteFile::Result)
- result.raw_file.should == tempfile
+ result.should == tempfile
cache_control_data.etag.should be_nil
cache_control_data.mtime.should be_nil
cache_control_data.checksum.should == fetched_content_checksum
@@ -226,9 +225,7 @@ describe Chef::Provider::RemoteFile::HTTP do
context "and the response does not contain an etag" do
let(:last_response) { {"etag" => nil} }
it "does not include an etag in the result" do
- result = fetcher.fetch
- result.should be_a_kind_of(Chef::Provider::RemoteFile::Result)
- result.etag.should be_nil
+ fetcher.fetch
cache_control_data.etag.should be_nil
cache_control_data.mtime.should be_nil
cache_control_data.checksum.should == fetched_content_checksum
@@ -239,9 +236,7 @@ describe Chef::Provider::RemoteFile::HTTP do
let(:last_response) { {"etag" => "abc123"} }
it "includes the etag value in the response" do
- result = fetcher.fetch
- result.raw_file.should == tempfile
- result.etag.should == "abc123"
+ fetcher.fetch
cache_control_data.etag.should == "abc123"
cache_control_data.mtime.should be_nil
cache_control_data.checksum.should == fetched_content_checksum
@@ -254,9 +249,7 @@ describe Chef::Provider::RemoteFile::HTTP do
it "does not set an mtime in the result" do
# RFC 2616 suggests that servers that do not set a Date header do not
# have a reliable clock, so no use in making them deal with dates.
- result = fetcher.fetch
- result.should be_a_kind_of(Chef::Provider::RemoteFile::Result)
- result.mtime.should be_nil
+ fetcher.fetch
cache_control_data.etag.should be_nil
cache_control_data.mtime.should be_nil
cache_control_data.checksum.should == fetched_content_checksum
@@ -270,9 +263,7 @@ describe Chef::Provider::RemoteFile::HTTP do
end
it "sets the mtime to the Last-Modified time in the response" do
- result = fetcher.fetch
- result.should be_a_kind_of(Chef::Provider::RemoteFile::Result)
- result.mtime.should == last_response["last_modified"]
+ fetcher.fetch
cache_control_data.etag.should be_nil
cache_control_data.mtime.should == last_response["last_modified"]
end
@@ -284,9 +275,7 @@ describe Chef::Provider::RemoteFile::HTTP do
end
it "sets the mtime to the Date in the response" do
- result = fetcher.fetch
- result.should be_a_kind_of(Chef::Provider::RemoteFile::Result)
- result.mtime.should == last_response["date"]
+ fetcher.fetch
cache_control_data.etag.should be_nil
cache_control_data.mtime.should == last_response["date"]
cache_control_data.checksum.should == fetched_content_checksum
diff --git a/spec/unit/provider/remote_file/local_file_spec.rb b/spec/unit/provider/remote_file/local_file_spec.rb
index 625b6e88ee..6b318f972a 100644
--- a/spec/unit/provider/remote_file/local_file_spec.rb
+++ b/spec/unit/provider/remote_file/local_file_spec.rb
@@ -52,9 +52,7 @@ describe Chef::Provider::RemoteFile::LocalFile do
::FileUtils.should_receive(:cp).with(uri.path, tempfile.path)
result = fetcher.fetch
- result.raw_file.should == tempfile
- result.etag.should be_nil
- result.mtime.should be_nil
+ result.should == tempfile
end
end