diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-12-07 11:15:23 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-01-03 10:53:48 -0800 |
commit | 10db9b3a50eae9c4c966f39f5beca8f5c17d441e (patch) | |
tree | 596bb3da0bcd1e2fe9a24e3a376fd6223cb6156f /spec/support | |
parent | 94ba9c022e57feb2949e22656d811a843b3410f1 (diff) | |
download | chef-10db9b3a50eae9c4c966f39f5beca8f5c17d441e.tar.gz |
change HTTPServerException to HTTPClientException for ruby 2.6
includes backcompat for 2.5
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared/context/client.rb | 2 | ||||
-rw-r--r-- | spec/support/shared/unit/api_error_inspector.rb | 10 | ||||
-rw-r--r-- | spec/support/shared/unit/api_versioning.rb | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/spec/support/shared/context/client.rb b/spec/support/shared/context/client.rb index 0054058d0f..d6c49c896b 100644 --- a/spec/support/shared/context/client.rb +++ b/spec/support/shared/context/client.rb @@ -142,7 +142,7 @@ shared_context "a client run" do def stub_for_required_recipe response = Net::HTTPNotFound.new("1.1", "404", "Not Found") - exception = Net::HTTPServerException.new('404 "Not Found"', response) + exception = Net::HTTPClientException.new('404 "Not Found"', response) expect(http_node_load).to receive(:get).with("required_recipe").and_raise(exception) end diff --git a/spec/support/shared/unit/api_error_inspector.rb b/spec/support/shared/unit/api_error_inspector.rb index 15c122e3dc..92ed9fcb99 100644 --- a/spec/support/shared/unit/api_error_inspector.rb +++ b/spec/support/shared/unit/api_error_inspector.rb @@ -71,7 +71,7 @@ shared_examples_for "an api error inspector" do @response_body = "synchronize the clock on your host" @response = Net::HTTPUnauthorized.new("1.1", "401", "(response) unauthorized") allow(@response).to receive(:body).and_return(@response_body) - @exception = Net::HTTPServerException.new("(exception) unauthorized", @response) + @exception = Net::HTTPClientException.new("(exception) unauthorized", @response) @inspector = described_class.new(@node_name, @exception, @config) @inspector.add_explanation(@description) end @@ -87,7 +87,7 @@ shared_examples_for "an api error inspector" do @response_body = "check your key and node name" @response = Net::HTTPUnauthorized.new("1.1", "401", "(response) unauthorized") allow(@response).to receive(:body).and_return(@response_body) - @exception = Net::HTTPServerException.new("(exception) unauthorized", @response) + @exception = Net::HTTPClientException.new("(exception) unauthorized", @response) @inspector = described_class.new(@node_name, @exception, @config) @inspector.add_explanation(@description) end @@ -103,7 +103,7 @@ shared_examples_for "an api error inspector" do @response_body = "forbidden" @response = Net::HTTPForbidden.new("1.1", "403", "(response) forbidden") allow(@response).to receive(:body).and_return(@response_body) - @exception = Net::HTTPServerException.new("(exception) forbidden", @response) + @exception = Net::HTTPClientException.new("(exception) forbidden", @response) @inspector = described_class.new(@node_name, @exception, @config) @inspector.add_explanation(@description) end @@ -119,7 +119,7 @@ shared_examples_for "an api error inspector" do @response_body = "didn't like your data" @response = Net::HTTPBadRequest.new("1.1", "400", "(response) bad request") allow(@response).to receive(:body).and_return(@response_body) - @exception = Net::HTTPServerException.new("(exception) bad request", @response) + @exception = Net::HTTPClientException.new("(exception) bad request", @response) @inspector = described_class.new(@node_name, @exception, @config) @inspector.add_explanation(@description) end @@ -135,7 +135,7 @@ shared_examples_for "an api error inspector" do @response_body = "probably caused by a redirect to a get" @response = Net::HTTPNotFound.new("1.1", "404", "(response) not found") allow(@response).to receive(:body).and_return(@response_body) - @exception = Net::HTTPServerException.new("(exception) not found", @response) + @exception = Net::HTTPClientException.new("(exception) not found", @response) @inspector = described_class.new(@node_name, @exception, @config) @inspector.add_explanation(@description) end diff --git a/spec/support/shared/unit/api_versioning.rb b/spec/support/shared/unit/api_versioning.rb index 9c179efa82..55718971ef 100644 --- a/spec/support/shared/unit/api_versioning.rb +++ b/spec/support/shared/unit/api_versioning.rb @@ -20,7 +20,7 @@ require "chef/exceptions" shared_examples_for "version handling" do let(:response_406) { OpenStruct.new(code: "406") } - let(:exception_406) { Net::HTTPServerException.new("406 Not Acceptable", response_406) } + let(:exception_406) { Net::HTTPClientException.new("406 Not Acceptable", response_406) } before do allow(rest_v1).to receive(http_verb).and_raise(exception_406) @@ -39,7 +39,7 @@ end # version handling shared_examples_for "user and client reregister" do let(:response_406) { OpenStruct.new(code: "406") } - let(:exception_406) { Net::HTTPServerException.new("406 Not Acceptable", response_406) } + let(:exception_406) { Net::HTTPClientException.new("406 Not Acceptable", response_406) } let(:generic_exception) { Exception.new } let(:min_version) { "2" } let(:max_version) { "5" } |