ruby-changes:51451
From: usa <ko1@a...>
Date: Thu, 14 Jun 2018 15:41:13 +0900 (JST)
Subject: [ruby-changes:51451] usa:r63659 (trunk): HTTPServerException is deprecated
usa 2018-06-14 15:41:09 +0900 (Thu, 14 Jun 2018) New Revision: 63659 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63659 Log: HTTPServerException is deprecated * spec/ruby/library/net/http/HTTPClientException_spec.rb: add. * spec/ruby/library/net/http/HTTPServerException_spec.rb: check deprecated message. * spec/ruby/library/net/http/httpresponse/*_spec.rb: use HTTPClientException instead of HTTPServerException. Added files: trunk/spec/ruby/library/net/http/HTTPClientExcepton_spec.rb Modified files: trunk/spec/ruby/library/net/http/HTTPServerException_spec.rb trunk/spec/ruby/library/net/http/httpresponse/error_spec.rb trunk/spec/ruby/library/net/http/httpresponse/error_type_spec.rb trunk/spec/ruby/library/net/http/httpresponse/exception_type_spec.rb trunk/spec/ruby/library/net/http/httpresponse/value_spec.rb Index: spec/ruby/library/net/http/httpresponse/value_spec.rb =================================================================== --- spec/ruby/library/net/http/httpresponse/value_spec.rb (revision 63658) +++ spec/ruby/library/net/http/httpresponse/value_spec.rb (revision 63659) @@ -16,7 +16,12 @@ describe "Net::HTTPResponse#value" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/net/http/httpresponse/value_spec.rb#L16 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) Index: spec/ruby/library/net/http/httpresponse/error_spec.rb =================================================================== --- spec/ruby/library/net/http/httpresponse/error_spec.rb (revision 63658) +++ spec/ruby/library/net/http/httpresponse/error_spec.rb (revision 63659) @@ -16,7 +16,12 @@ describe "Net::HTTPResponse#error!" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/net/http/httpresponse/error_spec.rb#L16 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) Index: spec/ruby/library/net/http/httpresponse/error_type_spec.rb =================================================================== --- spec/ruby/library/net/http/httpresponse/error_type_spec.rb (revision 63658) +++ spec/ruby/library/net/http/httpresponse/error_type_spec.rb (revision 63659) @@ -16,7 +16,12 @@ describe "Net::HTTPResponse#error_type" https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/net/http/httpresponse/error_type_spec.rb#L16 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 Index: spec/ruby/library/net/http/httpresponse/exception_type_spec.rb =================================================================== --- spec/ruby/library/net/http/httpresponse/exception_type_spec.rb (revision 63658) +++ spec/ruby/library/net/http/httpresponse/exception_type_spec.rb (revision 63659) @@ -7,7 +7,12 @@ describe "Net::HTTPResponse.exception_ty https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/net/http/httpresponse/exception_type_spec.rb#L7 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 Index: spec/ruby/library/net/http/HTTPClientExcepton_spec.rb =================================================================== --- spec/ruby/library/net/http/HTTPClientExcepton_spec.rb (nonexistent) +++ spec/ruby/library/net/http/HTTPClientExcepton_spec.rb (revision 63659) @@ -0,0 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/net/http/HTTPClientExcepton_spec.rb#L1 +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 Property changes on: spec/ruby/library/net/http/HTTPClientExcepton_spec.rb ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Index: spec/ruby/library/net/http/HTTPServerException_spec.rb =================================================================== --- spec/ruby/library/net/http/HTTPServerException_spec.rb (revision 63658) +++ spec/ruby/library/net/http/HTTPServerException_spec.rb (revision 63659) @@ -1,12 +1,26 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/net/http/HTTPServerException_spec.rb#L1 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/