diff options
author | Xabier de Zuazo <xabier@onddo.com> | 2014-01-14 05:28:15 +0100 |
---|---|---|
committer | Xabier de Zuazo <xabier@onddo.com> | 2014-01-14 05:28:15 +0100 |
commit | 23f7b9545ab2d75c5886147270cdd28fde180528 (patch) | |
tree | 63b241900556f05b422bc7ffb966cd4c5e90be72 | |
parent | ec900cf6b4f2e6908cfeb10a0610cf64a52ff5c1 (diff) | |
download | chef-23f7b9545ab2d75c5886147270cdd28fde180528.tar.gz |
CHEF-4762: Added a http_request test for testing false return value when not modified response
-rw-r--r-- | spec/unit/provider/http_request_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/unit/provider/http_request_spec.rb b/spec/unit/provider/http_request_spec.rb index 850e752408..3efdd6c5fd 100644 --- a/spec/unit/provider/http_request_spec.rb +++ b/spec/unit/provider/http_request_spec.rb @@ -135,6 +135,14 @@ describe Chef::Provider::HttpRequest do @new_resource.should be_updated end + it "should not update a HEAD request if a not modified response (CHEF-4762)" do + if_modified_since = File.mtime(__FILE__).httpdate + @new_resource.headers "If-Modified-Since" => if_modified_since + @http.should_receive(:head).with("http://www.opscode.com/?message=is cool", {"If-Modified-Since" => if_modified_since}).and_return(false) + @provider.run_action(:head) + @new_resource.should_not be_updated + end + it "should run a HEAD request with If-Modified-Since header" do @new_resource.headers "If-Modified-Since" => File.mtime(__FILE__).httpdate @http.should_receive(:head).with("http://www.opscode.com/?message=is cool", @new_resource.headers) |