diff options
6 files changed, 57 insertions, 9 deletions
diff --git a/spec/ruby/library/net/http/HTTPClientExcepton_spec.rb b/spec/ruby/library/net/http/HTTPClientExcepton_spec.rb new file mode 100644 index 0000000000..08347464ec --- /dev/null +++ b/spec/ruby/library/net/http/HTTPClientExcepton_spec.rb @@ -0,0 +1,14 @@ +require_relative '../../../spec_helper' +require 'net/http' + +ruby_version_is "2.6" do + describe "Net::HTTPClientException" do + it "is a subclass of Net::ProtoServerError" do + Net::HTTPClientException.should < Net::ProtoServerError + end + + it "includes the Net::HTTPExceptions module" do + Net::HTTPClientException.should < Net::HTTPExceptions + end + end +end diff --git a/spec/ruby/library/net/http/HTTPServerException_spec.rb b/spec/ruby/library/net/http/HTTPServerException_spec.rb index 94da749ded..3960effadd 100644 --- a/spec/ruby/library/net/http/HTTPServerException_spec.rb +++ b/spec/ruby/library/net/http/HTTPServerException_spec.rb @@ -1,12 +1,26 @@ require_relative '../../../spec_helper' require 'net/http' -describe "Net::HTTPServerException" do - it "is a subclass of Net::ProtoServerError" do - Net::HTTPServerException.should < Net::ProtoServerError +ruby_version_is ""..."2.6" do + describe "Net::HTTPServerException" do + it "is a subclass of Net::ProtoServerError" do + Net::HTTPServerException.should < Net::ProtoServerError + end + + it "includes the Net::HTTPExceptions module" do + Net::HTTPServerException.should < Net::HTTPExceptions + end end +end + +ruby_version_is "2.6" do + describe "Net::HTTPServerException" do + it "is a subclass of Net::ProtoServerError and is warned as deprecated" do + lambda { Net::HTTPServerException.should < Net::ProtoServerError }.should complain(/warning: constant Net::HTTPServerException is deprecated/) + end - it "includes the Net::HTTPExceptions module" do - Net::HTTPServerException.should < Net::HTTPExceptions + it "includes the Net::HTTPExceptions module and is warned as deprecated" do + lambda { Net::HTTPServerException.should < Net::HTTPExceptions }.should complain(/warning: constant Net::HTTPServerException is deprecated/) + end end end diff --git a/spec/ruby/library/net/http/httpresponse/error_spec.rb b/spec/ruby/library/net/http/httpresponse/error_spec.rb index 24297d5fad..a3a3cee162 100644 --- a/spec/ruby/library/net/http/httpresponse/error_spec.rb +++ b/spec/ruby/library/net/http/httpresponse/error_spec.rb @@ -16,7 +16,12 @@ describe "Net::HTTPResponse#error!" do lambda { res.error! }.should raise_error(Net::HTTPRetriableError) res = Net::HTTPClientError.new("1.0", "4xx", "test response") - lambda { res.error! }.should raise_error(Net::HTTPServerException) + ruby_version_is ""..."2.6" do + lambda { res.error! }.should raise_error(Net::HTTPServerException) + end + ruby_version_is "2.6" do + lambda { res.error! }.should raise_error(Net::HTTPClientException) + end res = Net::HTTPServerError.new("1.0", "5xx", "test response") lambda { res.error! }.should raise_error(Net::HTTPFatalError) diff --git a/spec/ruby/library/net/http/httpresponse/error_type_spec.rb b/spec/ruby/library/net/http/httpresponse/error_type_spec.rb index 9e45e8fac2..6705f8b1aa 100644 --- a/spec/ruby/library/net/http/httpresponse/error_type_spec.rb +++ b/spec/ruby/library/net/http/httpresponse/error_type_spec.rb @@ -16,7 +16,12 @@ describe "Net::HTTPResponse#error_type" do res.error_type.should == Net::HTTPRetriableError res = Net::HTTPClientError.new("1.0", "4xx", "test response") - res.error_type.should == Net::HTTPServerException + ruby_version_is ""..."2.6" do + res.error_type.should == Net::HTTPServerException + end + ruby_version_is "2.6" do + res.error_type.should == Net::HTTPClientException + end res = Net::HTTPServerError.new("1.0", "5xx", "test response") res.error_type.should == Net::HTTPFatalError diff --git a/spec/ruby/library/net/http/httpresponse/exception_type_spec.rb b/spec/ruby/library/net/http/httpresponse/exception_type_spec.rb index 74839463b7..c0812cd322 100644 --- a/spec/ruby/library/net/http/httpresponse/exception_type_spec.rb +++ b/spec/ruby/library/net/http/httpresponse/exception_type_spec.rb @@ -7,7 +7,12 @@ describe "Net::HTTPResponse.exception_type" do Net::HTTPInformation.exception_type.should == Net::HTTPError Net::HTTPSuccess.exception_type.should == Net::HTTPError Net::HTTPRedirection.exception_type.should == Net::HTTPRetriableError - Net::HTTPClientError.exception_type.should == Net::HTTPServerException + ruby_version_is ""..."2.6" do + Net::HTTPClientError.exception_type.should == Net::HTTPServerException + end + ruby_version_is "2.6" do + Net::HTTPClientError.exception_type.should == Net::HTTPClientException + end Net::HTTPServerError.exception_type.should == Net::HTTPFatalError end end diff --git a/spec/ruby/library/net/http/httpresponse/value_spec.rb b/spec/ruby/library/net/http/httpresponse/value_spec.rb index c53d724b40..1b19d1d6f7 100644 --- a/spec/ruby/library/net/http/httpresponse/value_spec.rb +++ b/spec/ruby/library/net/http/httpresponse/value_spec.rb @@ -16,7 +16,12 @@ describe "Net::HTTPResponse#value" do lambda { res.value }.should raise_error(Net::HTTPRetriableError) res = Net::HTTPClientError.new("1.0", "4xx", "test response") - lambda { res.value }.should raise_error(Net::HTTPServerException) + ruby_version_is ""..."2.6" do + lambda { res.value }.should raise_error(Net::HTTPServerException) + end + ruby_version_is "2.6" do + lambda { res.value }.should raise_error(Net::HTTPClientException) + end res = Net::HTTPServerError.new("1.0", "5xx", "test response") lambda { res.value }.should raise_error(Net::HTTPFatalError) |