summaryrefslogtreecommitdiff
path: root/chef/spec/unit/rest_spec.rb
diff options
context:
space:
mode:
authorAdam Jacob <adam@hjksolutions.com>2009-03-05 19:43:52 -0800
committerAdam Jacob <adam@hjksolutions.com>2009-03-05 19:43:52 -0800
commit550272586fe90b056b96cb7039adf979a1e1a386 (patch)
treebccb117f2727256ad7362ec01e241f0340263e14 /chef/spec/unit/rest_spec.rb
parentbdc84ef0b02dc79037791c5f63e18da524ba6fbb (diff)
parentec5024cfa0beae3045b4fcf7d750a97166cd410c (diff)
downloadchef-550272586fe90b056b96cb7039adf979a1e1a386.tar.gz
Updating NOTICE file, removing redundant ones
Diffstat (limited to 'chef/spec/unit/rest_spec.rb')
-rw-r--r--chef/spec/unit/rest_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/chef/spec/unit/rest_spec.rb b/chef/spec/unit/rest_spec.rb
index 525d17e148..8e789426ca 100644
--- a/chef/spec/unit/rest_spec.rb
+++ b/chef/spec/unit/rest_spec.rb
@@ -256,10 +256,19 @@ describe Chef::REST, "run_request method" do
@http_response_mock.stub!(:[]).with('location').and_return(@url_mock.path)
lambda { do_run_request(method=:GET, data=false, limit=1) }.should raise_error(ArgumentError)
end
+
+ it "should call run_request again on a Permanent Redirect response" do
+ @http_response_mock.stub!(:kind_of?).with(Net::HTTPSuccess).and_return(false)
+ @http_response_mock.stub!(:kind_of?).with(Net::HTTPFound).and_return(false)
+ @http_response_mock.stub!(:kind_of?).with(Net::HTTPMovedPermanently).and_return(true)
+ @http_response_mock.stub!(:[]).with('location').and_return(@url_mock.path)
+ lambda { do_run_request(method=:GET, data=false, limit=1) }.should raise_error(ArgumentError)
+ end
it "should raise an exception on an unsuccessful request" do
@http_response_mock.stub!(:kind_of?).with(Net::HTTPSuccess).and_return(false)
@http_response_mock.stub!(:kind_of?).with(Net::HTTPFound).and_return(false)
+ @http_response_mock.stub!(:kind_of?).with(Net::HTTPMovedPermanently).and_return(false)
@http_response_mock.should_receive(:error!)
do_run_request
end