diff options
Diffstat (limited to 'spec/ruby/library/net-http/http')
45 files changed, 159 insertions, 157 deletions
diff --git a/spec/ruby/library/net-http/http/Proxy_spec.rb b/spec/ruby/library/net-http/http/Proxy_spec.rb index a1a04fa00b..7753ce5e30 100644 --- a/spec/ruby/library/net-http/http/Proxy_spec.rb +++ b/spec/ruby/library/net-http/http/Proxy_spec.rb @@ -13,7 +13,7 @@ describe "Net::HTTP.Proxy" do it "sets the returned subclasses' proxy options based on the passed arguments" do http_with_proxy = Net::HTTP.Proxy("localhost", 1234, "rspec", "rocks") http_with_proxy.proxy_address.should == "localhost" - http_with_proxy.proxy_port.should eql(1234) + http_with_proxy.proxy_port.should.eql?(1234) http_with_proxy.proxy_user.should == "rspec" http_with_proxy.proxy_pass.should == "rocks" end @@ -22,14 +22,14 @@ end describe "Net::HTTP#proxy?" do describe "when self is no proxy class instance" do it "returns false" do - Net::HTTP.new("localhost", 3333).proxy?.should be_false + Net::HTTP.new("localhost", 3333).proxy?.should == false end end describe "when self is a proxy class instance" do it "returns false" do http_with_proxy = Net::HTTP.Proxy("localhost", 1234, "rspec", "rocks") - http_with_proxy.new("localhost", 3333).proxy?.should be_true + http_with_proxy.new("localhost", 3333).proxy?.should == true end end end diff --git a/spec/ruby/library/net-http/http/copy_spec.rb b/spec/ruby/library/net-http/http/copy_spec.rb index fba96c0f11..1f3e25009f 100644 --- a/spec/ruby/library/net-http/http/copy_spec.rb +++ b/spec/ruby/library/net-http/http/copy_spec.rb @@ -15,7 +15,7 @@ describe "Net::HTTP#copy" do it "sends a COPY request to the passed path and returns the response" do response = @http.copy("/request") - response.should be_kind_of(Net::HTTPResponse) + response.should.is_a?(Net::HTTPResponse) response.body.should == "Request type: COPY" end end diff --git a/spec/ruby/library/net-http/http/default_port_spec.rb b/spec/ruby/library/net-http/http/default_port_spec.rb index 95b7316a0c..20407d0b12 100644 --- a/spec/ruby/library/net-http/http/default_port_spec.rb +++ b/spec/ruby/library/net-http/http/default_port_spec.rb @@ -3,6 +3,6 @@ require 'net/http' describe "Net::HTTP.default_port" do it "returns 80" do - Net::HTTP.http_default_port.should eql(80) + Net::HTTP.http_default_port.should.eql?(80) end end diff --git a/spec/ruby/library/net-http/http/delete_spec.rb b/spec/ruby/library/net-http/http/delete_spec.rb index d73aa5b375..09ddd74000 100644 --- a/spec/ruby/library/net-http/http/delete_spec.rb +++ b/spec/ruby/library/net-http/http/delete_spec.rb @@ -15,7 +15,7 @@ describe "Net::HTTP#delete" do it "sends a DELETE request to the passed path and returns the response" do response = @http.delete("/request") - response.should be_kind_of(Net::HTTPResponse) + response.should.is_a?(Net::HTTPResponse) response.body.should == "Request type: DELETE" end end diff --git a/spec/ruby/library/net-http/http/finish_spec.rb b/spec/ruby/library/net-http/http/finish_spec.rb index d4aa00dffe..0d466675f3 100644 --- a/spec/ruby/library/net-http/http/finish_spec.rb +++ b/spec/ruby/library/net-http/http/finish_spec.rb @@ -17,13 +17,13 @@ describe "Net::HTTP#finish" do it "closes the tcp connection" do @http.start @http.finish - @http.started?.should be_false + @http.started?.should == false end end describe "when self has not been started yet" do it "raises an IOError" do - -> { @http.finish }.should raise_error(IOError) + -> { @http.finish }.should.raise(IOError) end end end diff --git a/spec/ruby/library/net-http/http/get_spec.rb b/spec/ruby/library/net-http/http/get_spec.rb index e64a61c52c..9be726dc3b 100644 --- a/spec/ruby/library/net-http/http/get_spec.rb +++ b/spec/ruby/library/net-http/http/get_spec.rb @@ -74,7 +74,7 @@ describe "Net::HTTP.get" do socket, client_thread = start_threads begin client_thread.raise my_exception, "my exception" - -> { client_thread.value }.should raise_error(my_exception) + -> { client_thread.value }.should.raise(my_exception) ensure socket.close end diff --git a/spec/ruby/library/net-http/http/head_spec.rb b/spec/ruby/library/net-http/http/head_spec.rb index 64621fa87b..4824d22534 100644 --- a/spec/ruby/library/net-http/http/head_spec.rb +++ b/spec/ruby/library/net-http/http/head_spec.rb @@ -16,10 +16,10 @@ describe "Net::HTTP#head" do it "sends a HEAD request to the passed path and returns the response" do response = @http.head("/request") # HEAD requests have no responses - response.body.should be_nil + response.body.should == nil end it "returns a Net::HTTPResponse" do - @http.head("/request").should be_kind_of(Net::HTTPResponse) + @http.head("/request").should.is_a?(Net::HTTPResponse) end end diff --git a/spec/ruby/library/net-http/http/http_default_port_spec.rb b/spec/ruby/library/net-http/http/http_default_port_spec.rb index 3b17bcd0a5..82c88e58a8 100644 --- a/spec/ruby/library/net-http/http/http_default_port_spec.rb +++ b/spec/ruby/library/net-http/http/http_default_port_spec.rb @@ -3,6 +3,6 @@ require 'net/http' describe "Net::HTTP.http_default_port" do it "returns 80" do - Net::HTTP.http_default_port.should eql(80) + Net::HTTP.http_default_port.should.eql?(80) end end diff --git a/spec/ruby/library/net-http/http/https_default_port_spec.rb b/spec/ruby/library/net-http/http/https_default_port_spec.rb index 8c24e1d97c..24b9c3b462 100644 --- a/spec/ruby/library/net-http/http/https_default_port_spec.rb +++ b/spec/ruby/library/net-http/http/https_default_port_spec.rb @@ -3,6 +3,6 @@ require 'net/http' describe "Net::HTTP.https_default_port" do it "returns 443" do - Net::HTTP.https_default_port.should eql(443) + Net::HTTP.https_default_port.should.eql?(443) end end diff --git a/spec/ruby/library/net-http/http/initialize_spec.rb b/spec/ruby/library/net-http/http/initialize_spec.rb index 78aa01e1aa..907314cb25 100644 --- a/spec/ruby/library/net-http/http/initialize_spec.rb +++ b/spec/ruby/library/net-http/http/initialize_spec.rb @@ -3,7 +3,7 @@ require 'net/http' describe "Net::HTTP#initialize" do it "is private" do - Net::HTTP.should have_private_instance_method(:initialize) + Net::HTTP.private_instance_methods(false).should.include?(:initialize) end describe "when passed address" do @@ -17,11 +17,11 @@ describe "Net::HTTP#initialize" do end it "sets the new Net::HTTP instance's port to the default HTTP port" do - @net.port.should eql(Net::HTTP.default_port) + @net.port.should.eql?(Net::HTTP.default_port) end it "does not start the new Net::HTTP instance" do - @net.started?.should be_false + @net.started?.should == false end end @@ -36,11 +36,11 @@ describe "Net::HTTP#initialize" do end it "sets the new Net::HTTP instance's port to the passed port" do - @net.port.should eql(3333) + @net.port.should.eql?(3333) end it "does not start the new Net::HTTP instance" do - @net.started?.should be_false + @net.started?.should == false end end end diff --git a/spec/ruby/library/net-http/http/inspect_spec.rb b/spec/ruby/library/net-http/http/inspect_spec.rb index b8f650809e..fd4e6116c7 100644 --- a/spec/ruby/library/net-http/http/inspect_spec.rb +++ b/spec/ruby/library/net-http/http/inspect_spec.rb @@ -15,7 +15,7 @@ describe "Net::HTTP#inspect" do end it "returns a String representation of self" do - @http.inspect.should be_kind_of(String) + @http.inspect.should.is_a?(String) @http.inspect.should == "#<Net::HTTP localhost:#{@port} open=false>" @http.start diff --git a/spec/ruby/library/net-http/http/lock_spec.rb b/spec/ruby/library/net-http/http/lock_spec.rb index aa1f944196..12df138ad0 100644 --- a/spec/ruby/library/net-http/http/lock_spec.rb +++ b/spec/ruby/library/net-http/http/lock_spec.rb @@ -15,7 +15,7 @@ describe "Net::HTTP#lock" do it "sends a LOCK request to the passed path and returns the response" do response = @http.lock("/request", "test=test") - response.should be_kind_of(Net::HTTPResponse) + response.should.is_a?(Net::HTTPResponse) response.body.should == "Request type: LOCK" end end diff --git a/spec/ruby/library/net-http/http/mkcol_spec.rb b/spec/ruby/library/net-http/http/mkcol_spec.rb index f8009f9059..b1a5055982 100644 --- a/spec/ruby/library/net-http/http/mkcol_spec.rb +++ b/spec/ruby/library/net-http/http/mkcol_spec.rb @@ -15,7 +15,7 @@ describe "Net::HTTP#mkcol" do it "sends a MKCOL request to the passed path and returns the response" do response = @http.mkcol("/request") - response.should be_kind_of(Net::HTTPResponse) + response.should.is_a?(Net::HTTPResponse) response.body.should == "Request type: MKCOL" end end diff --git a/spec/ruby/library/net-http/http/move_spec.rb b/spec/ruby/library/net-http/http/move_spec.rb index ae43016a2c..a57c2a0f49 100644 --- a/spec/ruby/library/net-http/http/move_spec.rb +++ b/spec/ruby/library/net-http/http/move_spec.rb @@ -20,6 +20,6 @@ describe "Net::HTTP#head" do end it "returns a Net::HTTPResponse" do - @http.move("/request").should be_kind_of(Net::HTTPResponse) + @http.move("/request").should.is_a?(Net::HTTPResponse) end end diff --git a/spec/ruby/library/net-http/http/new_spec.rb b/spec/ruby/library/net-http/http/new_spec.rb index 1ec6bbd0c0..8feb3d1351 100644 --- a/spec/ruby/library/net-http/http/new_spec.rb +++ b/spec/ruby/library/net-http/http/new_spec.rb @@ -8,8 +8,8 @@ describe "Net::HTTP.new" do end it "returns a Net::HTTP instance" do - @http.proxy?.should be_false - @http.instance_of?(Net::HTTP).should be_true + @http.proxy?.should == false + @http.instance_of?(Net::HTTP).should == true end it "sets the new Net::HTTP instance's address to the passed address" do @@ -17,11 +17,11 @@ describe "Net::HTTP.new" do end it "sets the new Net::HTTP instance's port to the default HTTP port" do - @http.port.should eql(Net::HTTP.default_port) + @http.port.should.eql?(Net::HTTP.default_port) end it "does not start the new Net::HTTP instance" do - @http.started?.should be_false + @http.started?.should == false end end @@ -31,8 +31,8 @@ describe "Net::HTTP.new" do end it "returns a Net::HTTP instance" do - @http.proxy?.should be_false - @http.instance_of?(Net::HTTP).should be_true + @http.proxy?.should == false + @http.instance_of?(Net::HTTP).should == true end it "sets the new Net::HTTP instance's address to the passed address" do @@ -40,44 +40,44 @@ describe "Net::HTTP.new" do end it "sets the new Net::HTTP instance's port to the passed port" do - @http.port.should eql(3333) + @http.port.should.eql?(3333) end it "does not start the new Net::HTTP instance" do - @http.started?.should be_false + @http.started?.should == false end end describe "when passed address, port, *proxy_options" do it "returns a Net::HTTP instance" do http = Net::HTTP.new("localhost", 3333, "localhost") - http.proxy?.should be_true - http.instance_of?(Net::HTTP).should be_true - http.should be_kind_of(Net::HTTP) + http.proxy?.should == true + http.instance_of?(Net::HTTP).should == true + http.should.is_a?(Net::HTTP) end it "correctly sets the passed Proxy options" do http = Net::HTTP.new("localhost", 3333, "localhost") http.proxy_address.should == "localhost" - http.proxy_port.should eql(80) - http.proxy_user.should be_nil - http.proxy_pass.should be_nil + http.proxy_port.should.eql?(80) + http.proxy_user.should == nil + http.proxy_pass.should == nil http = Net::HTTP.new("localhost", 3333, "localhost", 1234) http.proxy_address.should == "localhost" - http.proxy_port.should eql(1234) - http.proxy_user.should be_nil - http.proxy_pass.should be_nil + http.proxy_port.should.eql?(1234) + http.proxy_user.should == nil + http.proxy_pass.should == nil http = Net::HTTP.new("localhost", 3333, "localhost", 1234, "rubyspec") http.proxy_address.should == "localhost" - http.proxy_port.should eql(1234) + http.proxy_port.should.eql?(1234) http.proxy_user.should == "rubyspec" - http.proxy_pass.should be_nil + http.proxy_pass.should == nil http = Net::HTTP.new("localhost", 3333, "localhost", 1234, "rubyspec", "rocks") http.proxy_address.should == "localhost" - http.proxy_port.should eql(1234) + http.proxy_port.should.eql?(1234) http.proxy_user.should == "rubyspec" http.proxy_pass.should == "rocks" end diff --git a/spec/ruby/library/net-http/http/newobj_spec.rb b/spec/ruby/library/net-http/http/newobj_spec.rb index e19b30fca9..d398fb7d9a 100644 --- a/spec/ruby/library/net-http/http/newobj_spec.rb +++ b/spec/ruby/library/net-http/http/newobj_spec.rb @@ -8,7 +8,7 @@ describe "Net::HTTP.newobj" do describe "when passed address" do it "returns a new Net::HTTP instance" do - @net.should be_kind_of(Net::HTTP) + @net.should.is_a?(Net::HTTP) end it "sets the new Net::HTTP instance's address to the passed address" do @@ -16,11 +16,11 @@ describe "Net::HTTP.newobj" do end it "sets the new Net::HTTP instance's port to the default HTTP port" do - @net.port.should eql(Net::HTTP.default_port) + @net.port.should.eql?(Net::HTTP.default_port) end it "does not start the new Net::HTTP instance" do - @net.started?.should be_false + @net.started?.should == false end end @@ -30,7 +30,7 @@ describe "Net::HTTP.newobj" do end it "returns a new Net::HTTP instance" do - @net.should be_kind_of(Net::HTTP) + @net.should.is_a?(Net::HTTP) end it "sets the new Net::HTTP instance's address to the passed address" do @@ -38,11 +38,11 @@ describe "Net::HTTP.newobj" do end it "sets the new Net::HTTP instance's port to the passed port" do - @net.port.should eql(3333) + @net.port.should.eql?(3333) end it "does not start the new Net::HTTP instance" do - @net.started?.should be_false + @net.started?.should == false end end end diff --git a/spec/ruby/library/net-http/http/open_timeout_spec.rb b/spec/ruby/library/net-http/http/open_timeout_spec.rb index 0d93752271..d00f844b38 100644 --- a/spec/ruby/library/net-http/http/open_timeout_spec.rb +++ b/spec/ruby/library/net-http/http/open_timeout_spec.rb @@ -4,9 +4,9 @@ require 'net/http' describe "Net::HTTP#open_timeout" do it "returns the seconds to wait till the connection is open" do net = Net::HTTP.new("localhost") - net.open_timeout.should eql(60) + net.open_timeout.should.eql?(60) net.open_timeout = 10 - net.open_timeout.should eql(10) + net.open_timeout.should.eql?(10) end end @@ -14,11 +14,11 @@ describe "Net::HTTP#open_timeout=" do it "sets the seconds to wait till the connection is open" do net = Net::HTTP.new("localhost") net.open_timeout = 10 - net.open_timeout.should eql(10) + net.open_timeout.should.eql?(10) end it "returns the newly set value" do net = Net::HTTP.new("localhost") - (net.open_timeout = 10).should eql(10) + (net.open_timeout = 10).should.eql?(10) end end diff --git a/spec/ruby/library/net-http/http/options_spec.rb b/spec/ruby/library/net-http/http/options_spec.rb index 3d9887a557..3b90573cfa 100644 --- a/spec/ruby/library/net-http/http/options_spec.rb +++ b/spec/ruby/library/net-http/http/options_spec.rb @@ -20,6 +20,6 @@ describe "Net::HTTP#options" do end it "returns a Net::HTTPResponse" do - @http.options("/request").should be_kind_of(Net::HTTPResponse) + @http.options("/request").should.is_a?(Net::HTTPResponse) end end diff --git a/spec/ruby/library/net-http/http/port_spec.rb b/spec/ruby/library/net-http/http/port_spec.rb index 0984d5e6ce..edb689f9ca 100644 --- a/spec/ruby/library/net-http/http/port_spec.rb +++ b/spec/ruby/library/net-http/http/port_spec.rb @@ -4,6 +4,6 @@ require 'net/http' describe "Net::HTTP#port" do it "returns the current port number" do net = Net::HTTP.new("localhost", 3333) - net.port.should eql(3333) + net.port.should.eql?(3333) end end diff --git a/spec/ruby/library/net-http/http/post_spec.rb b/spec/ruby/library/net-http/http/post_spec.rb index ac020bd6be..f294411197 100644 --- a/spec/ruby/library/net-http/http/post_spec.rb +++ b/spec/ruby/library/net-http/http/post_spec.rb @@ -22,12 +22,14 @@ describe "Net::HTTP.post" do it "returns a Net::HTTPResponse" do response = Net::HTTP.post(URI("http://localhost:#{NetHTTPSpecs.port}/request"), "test=test") - response.should be_kind_of(Net::HTTPResponse) + response.should.is_a?(Net::HTTPResponse) end - it "sends Content-Type: application/x-www-form-urlencoded by default" do - response = Net::HTTP.post(URI("http://localhost:#{NetHTTPSpecs.port}/request/header"), "test=test") - response.body.should include({ "Content-Type" => "application/x-www-form-urlencoded" }.inspect.delete("{}")) + ruby_version_is ""..."4.0" do + it "sends Content-Type: application/x-www-form-urlencoded by default" do + response = Net::HTTP.post(URI("http://localhost:#{NetHTTPSpecs.port}/request/header"), "test=test") + response.body.should.include?({ "Content-Type" => "application/x-www-form-urlencoded" }.inspect.delete("{}")) + end end it "does not support HTTP Basic Auth" do @@ -55,7 +57,7 @@ describe "Net::HTTP#post" do end it "returns a Net::HTTPResponse" do - @http.post("/request", "test=test").should be_kind_of(Net::HTTPResponse) + @http.post("/request", "test=test").should.is_a?(Net::HTTPResponse) end describe "when passed a block" do @@ -68,7 +70,7 @@ describe "Net::HTTP#post" do end it "returns a Net::HTTPResponse" do - @http.post("/request", "test=test") {}.should be_kind_of(Net::HTTPResponse) + @http.post("/request", "test=test") {}.should.is_a?(Net::HTTPResponse) end end end diff --git a/spec/ruby/library/net-http/http/propfind_spec.rb b/spec/ruby/library/net-http/http/propfind_spec.rb index f3742d1b1a..6a1be0392a 100644 --- a/spec/ruby/library/net-http/http/propfind_spec.rb +++ b/spec/ruby/library/net-http/http/propfind_spec.rb @@ -19,6 +19,6 @@ describe "Net::HTTP#propfind" do end it "returns a Net::HTTPResponse" do - @http.propfind("/request", "test=test").should be_kind_of(Net::HTTPResponse) + @http.propfind("/request", "test=test").should.is_a?(Net::HTTPResponse) end end diff --git a/spec/ruby/library/net-http/http/proppatch_spec.rb b/spec/ruby/library/net-http/http/proppatch_spec.rb index 0163d24d46..074dfafaef 100644 --- a/spec/ruby/library/net-http/http/proppatch_spec.rb +++ b/spec/ruby/library/net-http/http/proppatch_spec.rb @@ -19,6 +19,6 @@ describe "Net::HTTP#proppatch" do end it "returns a Net::HTTPResponse" do - @http.proppatch("/request", "test=test").should be_kind_of(Net::HTTPResponse) + @http.proppatch("/request", "test=test").should.is_a?(Net::HTTPResponse) end end diff --git a/spec/ruby/library/net-http/http/proxy_address_spec.rb b/spec/ruby/library/net-http/http/proxy_address_spec.rb index 5b5efb7ac0..ba040336ad 100644 --- a/spec/ruby/library/net-http/http/proxy_address_spec.rb +++ b/spec/ruby/library/net-http/http/proxy_address_spec.rb @@ -4,7 +4,7 @@ require 'net/http' describe "Net::HTTP.proxy_address" do describe "when self is no proxy class" do it "returns nil" do - Net::HTTP.proxy_address.should be_nil + Net::HTTP.proxy_address.should == nil end end @@ -18,7 +18,7 @@ end describe "Net::HTTP#proxy_address" do describe "when self is no proxy class instance" do it "returns nil" do - Net::HTTP.new("localhost", 3333).proxy_address.should be_nil + Net::HTTP.new("localhost", 3333).proxy_address.should == nil end end diff --git a/spec/ruby/library/net-http/http/proxy_class_spec.rb b/spec/ruby/library/net-http/http/proxy_class_spec.rb index 00975aef4e..eda027c893 100644 --- a/spec/ruby/library/net-http/http/proxy_class_spec.rb +++ b/spec/ruby/library/net-http/http/proxy_class_spec.rb @@ -3,7 +3,7 @@ require 'net/http' describe "Net::HTTP.proxy_class?" do it "returns true if self is a class created with Net::HTTP.Proxy" do - Net::HTTP.proxy_class?.should be_false - Net::HTTP.Proxy("localhost").proxy_class?.should be_true + Net::HTTP.proxy_class?.should == false + Net::HTTP.Proxy("localhost").proxy_class?.should == true end end diff --git a/spec/ruby/library/net-http/http/proxy_pass_spec.rb b/spec/ruby/library/net-http/http/proxy_pass_spec.rb index 4e393a53ff..ad02d896c0 100644 --- a/spec/ruby/library/net-http/http/proxy_pass_spec.rb +++ b/spec/ruby/library/net-http/http/proxy_pass_spec.rb @@ -4,13 +4,13 @@ require 'net/http' describe "Net::HTTP.proxy_pass" do describe "when self is no proxy class" do it "returns nil" do - Net::HTTP.proxy_pass.should be_nil + Net::HTTP.proxy_pass.should == nil end end describe "when self is a proxy class" do it "returns nil if no password was set for self's proxy connection" do - Net::HTTP.Proxy("localhost").proxy_pass.should be_nil + Net::HTTP.Proxy("localhost").proxy_pass.should == nil end it "returns the password for self's proxy connection" do @@ -22,13 +22,13 @@ end describe "Net::HTTP#proxy_pass" do describe "when self is no proxy class instance" do it "returns nil" do - Net::HTTP.new("localhost", 3333).proxy_pass.should be_nil + Net::HTTP.new("localhost", 3333).proxy_pass.should == nil end end describe "when self is a proxy class instance" do it "returns nil if no password was set for self's proxy connection" do - Net::HTTP.Proxy("localhost").new("localhost", 3333).proxy_pass.should be_nil + Net::HTTP.Proxy("localhost").new("localhost", 3333).proxy_pass.should == nil end it "returns the password for self's proxy connection" do diff --git a/spec/ruby/library/net-http/http/proxy_port_spec.rb b/spec/ruby/library/net-http/http/proxy_port_spec.rb index d7d37f3927..21c1e4180e 100644 --- a/spec/ruby/library/net-http/http/proxy_port_spec.rb +++ b/spec/ruby/library/net-http/http/proxy_port_spec.rb @@ -4,17 +4,17 @@ require 'net/http' describe "Net::HTTP.proxy_port" do describe "when self is no proxy class" do it "returns nil" do - Net::HTTP.proxy_port.should be_nil + Net::HTTP.proxy_port.should == nil end end describe "when self is a proxy class" do it "returns 80 if no port was set for self's proxy connection" do - Net::HTTP.Proxy("localhost").proxy_port.should eql(80) + Net::HTTP.Proxy("localhost").proxy_port.should.eql?(80) end it "returns the port for self's proxy connection" do - Net::HTTP.Proxy("localhost", 1234, "rspec", "rocks").proxy_port.should eql(1234) + Net::HTTP.Proxy("localhost", 1234, "rspec", "rocks").proxy_port.should.eql?(1234) end end end @@ -22,18 +22,18 @@ end describe "Net::HTTP#proxy_port" do describe "when self is no proxy class instance" do it "returns nil" do - Net::HTTP.new("localhost", 3333).proxy_port.should be_nil + Net::HTTP.new("localhost", 3333).proxy_port.should == nil end end describe "when self is a proxy class instance" do it "returns 80 if no port was set for self's proxy connection" do - Net::HTTP.Proxy("localhost").new("localhost", 3333).proxy_port.should eql(80) + Net::HTTP.Proxy("localhost").new("localhost", 3333).proxy_port.should.eql?(80) end it "returns the port for self's proxy connection" do http_with_proxy = Net::HTTP.Proxy("localhost", 1234, "rspec", "rocks") - http_with_proxy.new("localhost", 3333).proxy_port.should eql(1234) + http_with_proxy.new("localhost", 3333).proxy_port.should.eql?(1234) end end end diff --git a/spec/ruby/library/net-http/http/proxy_user_spec.rb b/spec/ruby/library/net-http/http/proxy_user_spec.rb index ef7654425d..492ea2e8ee 100644 --- a/spec/ruby/library/net-http/http/proxy_user_spec.rb +++ b/spec/ruby/library/net-http/http/proxy_user_spec.rb @@ -4,13 +4,13 @@ require 'net/http' describe "Net::HTTP.proxy_user" do describe "when self is no proxy class" do it "returns nil" do - Net::HTTP.proxy_user.should be_nil + Net::HTTP.proxy_user.should == nil end end describe "when self is a proxy class" do it "returns nil if no username was set for self's proxy connection" do - Net::HTTP.Proxy("localhost").proxy_user.should be_nil + Net::HTTP.Proxy("localhost").proxy_user.should == nil end it "returns the username for self's proxy connection" do @@ -22,13 +22,13 @@ end describe "Net::HTTP#proxy_user" do describe "when self is no proxy class instance" do it "returns nil" do - Net::HTTP.new("localhost", 3333).proxy_user.should be_nil + Net::HTTP.new("localhost", 3333).proxy_user.should == nil end end describe "when self is a proxy class instance" do it "returns nil if no username was set for self's proxy connection" do - Net::HTTP.Proxy("localhost").new("localhost", 3333).proxy_user.should be_nil + Net::HTTP.Proxy("localhost").new("localhost", 3333).proxy_user.should == nil end it "returns the username for self's proxy connection" do diff --git a/spec/ruby/library/net-http/http/put_spec.rb b/spec/ruby/library/net-http/http/put_spec.rb index 75f3c243d4..7ef9219f63 100644 --- a/spec/ruby/library/net-http/http/put_spec.rb +++ b/spec/ruby/library/net-http/http/put_spec.rb @@ -19,6 +19,6 @@ describe "Net::HTTP#put" do end it "returns a Net::HTTPResponse" do - @http.put("/request", "test=test").should be_kind_of(Net::HTTPResponse) + @http.put("/request", "test=test").should.is_a?(Net::HTTPResponse) end end diff --git a/spec/ruby/library/net-http/http/read_timeout_spec.rb b/spec/ruby/library/net-http/http/read_timeout_spec.rb index 7a0d2f1d72..81e71337bb 100644 --- a/spec/ruby/library/net-http/http/read_timeout_spec.rb +++ b/spec/ruby/library/net-http/http/read_timeout_spec.rb @@ -4,9 +4,9 @@ require 'net/http' describe "Net::HTTP#read_timeout" do it "returns the seconds to wait until reading one block" do net = Net::HTTP.new("localhost") - net.read_timeout.should eql(60) + net.read_timeout.should.eql?(60) net.read_timeout = 10 - net.read_timeout.should eql(10) + net.read_timeout.should.eql?(10) end end @@ -14,11 +14,11 @@ describe "Net::HTTP#read_timeout=" do it "sets the seconds to wait till the connection is open" do net = Net::HTTP.new("localhost") net.read_timeout = 10 - net.read_timeout.should eql(10) + net.read_timeout.should.eql?(10) end it "returns the newly set value" do net = Net::HTTP.new("localhost") - (net.read_timeout = 10).should eql(10) + (net.read_timeout = 10).should.eql?(10) end end diff --git a/spec/ruby/library/net-http/http/request_spec.rb b/spec/ruby/library/net-http/http/request_spec.rb index 356e605b3b..e05ee96b55 100644 --- a/spec/ruby/library/net-http/http/request_spec.rb +++ b/spec/ruby/library/net-http/http/request_spec.rb @@ -19,7 +19,7 @@ describe "Net::HTTP#request" do response.body.should == "Request type: GET" response = @http.request(Net::HTTP::Head.new("/request"), "test=test") - response.body.should be_nil + response.body.should == nil response = @http.request(Net::HTTP::Post.new("/request"), "test=test") response.body.should == "Request type: POST" @@ -38,7 +38,7 @@ describe "Net::HTTP#request" do # TODO: Does not work? #response = @http.request(Net::HTTP::Options.new("/request"), "test=test") - #response.body.should be_nil + #response.body.should == nil response = @http.request(Net::HTTP::Propfind.new("/request"), "test=test") response.body.should == "Request type: PROPFIND" @@ -66,7 +66,7 @@ describe "Net::HTTP#request" do response.body.should == "test=test" response = @http.request(Net::HTTP::Head.new("/request/body"), "test=test") - response.body.should be_nil + response.body.should == nil response = @http.request(Net::HTTP::Post.new("/request/body"), "test=test") response.body.should == "test=test" @@ -85,7 +85,7 @@ describe "Net::HTTP#request" do # TODO: Does not work? #response = @http.request(Net::HTTP::Options.new("/request/body"), "test=test") - #response.body.should be_nil + #response.body.should == nil response = @http.request(Net::HTTP::Propfind.new("/request/body"), "test=test") response.body.should == "test=test" diff --git a/spec/ruby/library/net-http/http/request_types_spec.rb b/spec/ruby/library/net-http/http/request_types_spec.rb index 53aef1ee58..0adc625979 100644 --- a/spec/ruby/library/net-http/http/request_types_spec.rb +++ b/spec/ruby/library/net-http/http/request_types_spec.rb @@ -11,11 +11,11 @@ describe "Net::HTTP::Get" do end it "has no Request Body" do - Net::HTTP::Get::REQUEST_HAS_BODY.should be_false + Net::HTTP::Get::REQUEST_HAS_BODY.should == false end it "has a Response Body" do - Net::HTTP::Get::RESPONSE_HAS_BODY.should be_true + Net::HTTP::Get::RESPONSE_HAS_BODY.should == true end end @@ -29,11 +29,11 @@ describe "Net::HTTP::Head" do end it "has no Request Body" do - Net::HTTP::Head::REQUEST_HAS_BODY.should be_false + Net::HTTP::Head::REQUEST_HAS_BODY.should == false end it "has no Response Body" do - Net::HTTP::Head::RESPONSE_HAS_BODY.should be_false + Net::HTTP::Head::RESPONSE_HAS_BODY.should == false end end @@ -47,11 +47,11 @@ describe "Net::HTTP::Post" do end it "has a Request Body" do - Net::HTTP::Post::REQUEST_HAS_BODY.should be_true + Net::HTTP::Post::REQUEST_HAS_BODY.should == true end it "has a Response Body" do - Net::HTTP::Post::RESPONSE_HAS_BODY.should be_true + Net::HTTP::Post::RESPONSE_HAS_BODY.should == true end end @@ -65,11 +65,11 @@ describe "Net::HTTP::Put" do end it "has a Request Body" do - Net::HTTP::Put::REQUEST_HAS_BODY.should be_true + Net::HTTP::Put::REQUEST_HAS_BODY.should == true end it "has a Response Body" do - Net::HTTP::Put::RESPONSE_HAS_BODY.should be_true + Net::HTTP::Put::RESPONSE_HAS_BODY.should == true end end @@ -83,11 +83,11 @@ describe "Net::HTTP::Delete" do end it "has no Request Body" do - Net::HTTP::Delete::REQUEST_HAS_BODY.should be_false + Net::HTTP::Delete::REQUEST_HAS_BODY.should == false end it "has a Response Body" do - Net::HTTP::Delete::RESPONSE_HAS_BODY.should be_true + Net::HTTP::Delete::RESPONSE_HAS_BODY.should == true end end @@ -101,11 +101,11 @@ describe "Net::HTTP::Options" do end it "has no Request Body" do - Net::HTTP::Options::REQUEST_HAS_BODY.should be_false + Net::HTTP::Options::REQUEST_HAS_BODY.should == false end it "has no Response Body" do - Net::HTTP::Options::RESPONSE_HAS_BODY.should be_true + Net::HTTP::Options::RESPONSE_HAS_BODY.should == true end end @@ -119,11 +119,11 @@ describe "Net::HTTP::Trace" do end it "has no Request Body" do - Net::HTTP::Trace::REQUEST_HAS_BODY.should be_false + Net::HTTP::Trace::REQUEST_HAS_BODY.should == false end it "has a Response Body" do - Net::HTTP::Trace::RESPONSE_HAS_BODY.should be_true + Net::HTTP::Trace::RESPONSE_HAS_BODY.should == true end end @@ -137,11 +137,11 @@ describe "Net::HTTP::Propfind" do end it "has a Request Body" do - Net::HTTP::Propfind::REQUEST_HAS_BODY.should be_true + Net::HTTP::Propfind::REQUEST_HAS_BODY.should == true end it "has a Response Body" do - Net::HTTP::Propfind::RESPONSE_HAS_BODY.should be_true + Net::HTTP::Propfind::RESPONSE_HAS_BODY.should == true end end @@ -155,11 +155,11 @@ describe "Net::HTTP::Proppatch" do end it "has a Request Body" do - Net::HTTP::Proppatch::REQUEST_HAS_BODY.should be_true + Net::HTTP::Proppatch::REQUEST_HAS_BODY.should == true end it "has a Response Body" do - Net::HTTP::Proppatch::RESPONSE_HAS_BODY.should be_true + Net::HTTP::Proppatch::RESPONSE_HAS_BODY.should == true end end @@ -173,11 +173,11 @@ describe "Net::HTTP::Mkcol" do end it "has a Request Body" do - Net::HTTP::Mkcol::REQUEST_HAS_BODY.should be_true + Net::HTTP::Mkcol::REQUEST_HAS_BODY.should == true end it "has a Response Body" do - Net::HTTP::Mkcol::RESPONSE_HAS_BODY.should be_true + Net::HTTP::Mkcol::RESPONSE_HAS_BODY.should == true end end @@ -191,11 +191,11 @@ describe "Net::HTTP::Copy" do end it "has no Request Body" do - Net::HTTP::Copy::REQUEST_HAS_BODY.should be_false + Net::HTTP::Copy::REQUEST_HAS_BODY.should == false end it "has a Response Body" do - Net::HTTP::Copy::RESPONSE_HAS_BODY.should be_true + Net::HTTP::Copy::RESPONSE_HAS_BODY.should == true end end @@ -209,11 +209,11 @@ describe "Net::HTTP::Move" do end it "has no Request Body" do - Net::HTTP::Move::REQUEST_HAS_BODY.should be_false + Net::HTTP::Move::REQUEST_HAS_BODY.should == false end it "has a Response Body" do - Net::HTTP::Move::RESPONSE_HAS_BODY.should be_true + Net::HTTP::Move::RESPONSE_HAS_BODY.should == true end end @@ -227,11 +227,11 @@ describe "Net::HTTP::Lock" do end it "has a Request Body" do - Net::HTTP::Lock::REQUEST_HAS_BODY.should be_true + Net::HTTP::Lock::REQUEST_HAS_BODY.should == true end it "has a Response Body" do - Net::HTTP::Lock::RESPONSE_HAS_BODY.should be_true + Net::HTTP::Lock::RESPONSE_HAS_BODY.should == true end end @@ -245,10 +245,10 @@ describe "Net::HTTP::Unlock" do end it "has a Request Body" do - Net::HTTP::Unlock::REQUEST_HAS_BODY.should be_true + Net::HTTP::Unlock::REQUEST_HAS_BODY.should == true end it "has a Response Body" do - Net::HTTP::Unlock::RESPONSE_HAS_BODY.should be_true + Net::HTTP::Unlock::RESPONSE_HAS_BODY.should == true end end diff --git a/spec/ruby/library/net-http/http/send_request_spec.rb b/spec/ruby/library/net-http/http/send_request_spec.rb index af35c068ce..e2dfc505b6 100644 --- a/spec/ruby/library/net-http/http/send_request_spec.rb +++ b/spec/ruby/library/net-http/http/send_request_spec.rb @@ -24,7 +24,7 @@ describe "Net::HTTP#send_request" do describe "when passed type, path" do it "sends a HTTP Request of the passed type to the passed path" do response = @http.send_request("HEAD", "/request") - response.body.should be_nil + response.body.should == nil (@methods - %w[POST PUT]).each do |method| response = @http.send_request(method, "/request") @@ -36,7 +36,7 @@ describe "Net::HTTP#send_request" do describe "when passed type, path, body" do it "sends a HTTP Request with the passed body" do response = @http.send_request("HEAD", "/request/body", "test=test") - response.body.should be_nil + response.body.should == nil @methods.each do |method| response = @http.send_request(method, "/request/body", "test=test") @@ -50,11 +50,11 @@ describe "Net::HTTP#send_request" do referer = 'https://www.ruby-lang.org/'.freeze response = @http.send_request("HEAD", "/request/header", "test=test", "referer" => referer) - response.body.should be_nil + response.body.should == nil @methods.each do |method| response = @http.send_request(method, "/request/header", "test=test", "referer" => referer) - response.body.should include({ "Referer" => referer }.inspect.delete("{}")) + response.body.should.include?({ "Referer" => referer }.inspect.delete("{}")) end end end diff --git a/spec/ruby/library/net-http/http/set_debug_output_spec.rb b/spec/ruby/library/net-http/http/set_debug_output_spec.rb index 5ceecb39fb..491ac38b5d 100644 --- a/spec/ruby/library/net-http/http/set_debug_output_spec.rb +++ b/spec/ruby/library/net-http/http/set_debug_output_spec.rb @@ -19,7 +19,7 @@ describe "Net::HTTP#set_debug_output when passed io" do @http.set_debug_output(io) @http.start - io.string.should_not be_empty + io.string.should_not.empty? size = io.string.size @http.get("/") diff --git a/spec/ruby/library/net-http/http/shared/request_get.rb b/spec/ruby/library/net-http/http/shared/request_get.rb index d25f32049b..4f2f152ea4 100644 --- a/spec/ruby/library/net-http/http/shared/request_get.rb +++ b/spec/ruby/library/net-http/http/shared/request_get.rb @@ -17,7 +17,7 @@ describe :net_http_request_get, shared: true do it "returns a Net::HTTPResponse object" do response = @http.send(@method, "/request") - response.should be_kind_of(Net::HTTPResponse) + response.should.is_a?(Net::HTTPResponse) end end @@ -35,7 +35,7 @@ describe :net_http_request_get, shared: true do it "returns a Net::HTTPResponse object" do response = @http.send(@method, "/request") {} - response.should be_kind_of(Net::HTTPResponse) + response.should.is_a?(Net::HTTPResponse) end end end diff --git a/spec/ruby/library/net-http/http/shared/request_head.rb b/spec/ruby/library/net-http/http/shared/request_head.rb index 78b555884b..a5fe787d32 100644 --- a/spec/ruby/library/net-http/http/shared/request_head.rb +++ b/spec/ruby/library/net-http/http/shared/request_head.rb @@ -12,30 +12,30 @@ describe :net_http_request_head, shared: true do describe "when passed no block" do it "sends a head request to the passed path and returns the response" do response = @http.send(@method, "/request") - response.body.should be_nil + response.body.should == nil end it "returns a Net::HTTPResponse object" do response = @http.send(@method, "/request") - response.should be_kind_of(Net::HTTPResponse) + response.should.is_a?(Net::HTTPResponse) end end describe "when passed a block" do it "sends a head request to the passed path and returns the response" do response = @http.send(@method, "/request") {} - response.body.should be_nil + response.body.should == nil end it "yields the response to the passed block" do @http.send(@method, "/request") do |response| - response.body.should be_nil + response.body.should == nil end end it "returns a Net::HTTPResponse object" do response = @http.send(@method, "/request") {} - response.should be_kind_of(Net::HTTPResponse) + response.should.is_a?(Net::HTTPResponse) end end end diff --git a/spec/ruby/library/net-http/http/shared/request_post.rb b/spec/ruby/library/net-http/http/shared/request_post.rb index e832411c48..73cfd577cf 100644 --- a/spec/ruby/library/net-http/http/shared/request_post.rb +++ b/spec/ruby/library/net-http/http/shared/request_post.rb @@ -17,7 +17,7 @@ describe :net_http_request_post, shared: true do it "returns a Net::HTTPResponse object" do response = @http.send(@method, "/request", "test=test") - response.should be_kind_of(Net::HTTPResponse) + response.should.is_a?(Net::HTTPResponse) end end @@ -35,7 +35,7 @@ describe :net_http_request_post, shared: true do it "returns a Net::HTTPResponse object" do response = @http.send(@method, "/request", "test=test") {} - response.should be_kind_of(Net::HTTPResponse) + response.should.is_a?(Net::HTTPResponse) end end end diff --git a/spec/ruby/library/net-http/http/shared/request_put.rb b/spec/ruby/library/net-http/http/shared/request_put.rb index 3b902f4957..3b64d7e055 100644 --- a/spec/ruby/library/net-http/http/shared/request_put.rb +++ b/spec/ruby/library/net-http/http/shared/request_put.rb @@ -17,7 +17,7 @@ describe :net_http_request_put, shared: true do it "returns a Net::HTTPResponse object" do response = @http.send(@method, "/request", "test=test") - response.should be_kind_of(Net::HTTPResponse) + response.should.is_a?(Net::HTTPResponse) end end @@ -35,7 +35,7 @@ describe :net_http_request_put, shared: true do it "returns a Net::HTTPResponse object" do response = @http.send(@method, "/request", "test=test") {} - response.should be_kind_of(Net::HTTPResponse) + response.should.is_a?(Net::HTTPResponse) end end end diff --git a/spec/ruby/library/net-http/http/shared/started.rb b/spec/ruby/library/net-http/http/shared/started.rb index 9ff6272c31..0ab18a4e83 100644 --- a/spec/ruby/library/net-http/http/shared/started.rb +++ b/spec/ruby/library/net-http/http/shared/started.rb @@ -11,16 +11,16 @@ describe :net_http_started_p, shared: true do it "returns true when self has been started" do @http.start - @http.send(@method).should be_true + @http.send(@method).should == true end it "returns false when self has not been started yet" do - @http.send(@method).should be_false + @http.send(@method).should == false end it "returns false when self has been stopped again" do @http.start @http.finish - @http.send(@method).should be_false + @http.send(@method).should == false end end diff --git a/spec/ruby/library/net-http/http/shared/version_1_1.rb b/spec/ruby/library/net-http/http/shared/version_1_1.rb index db3d6a986d..84e7264eab 100644 --- a/spec/ruby/library/net-http/http/shared/version_1_1.rb +++ b/spec/ruby/library/net-http/http/shared/version_1_1.rb @@ -1,6 +1,6 @@ describe :net_http_version_1_1_p, shared: true do it "returns the state of net/http 1.1 features" do Net::HTTP.version_1_2 - Net::HTTP.send(@method).should be_false + Net::HTTP.send(@method).should == false end end diff --git a/spec/ruby/library/net-http/http/shared/version_1_2.rb b/spec/ruby/library/net-http/http/shared/version_1_2.rb index b044182c60..dcf5419704 100644 --- a/spec/ruby/library/net-http/http/shared/version_1_2.rb +++ b/spec/ruby/library/net-http/http/shared/version_1_2.rb @@ -1,6 +1,6 @@ describe :net_http_version_1_2_p, shared: true do it "returns the state of net/http 1.2 features" do Net::HTTP.version_1_2 - Net::HTTP.send(@method).should be_true + Net::HTTP.send(@method).should == true end end diff --git a/spec/ruby/library/net-http/http/start_spec.rb b/spec/ruby/library/net-http/http/start_spec.rb index 0ce3e79269..1aebc16f4d 100644 --- a/spec/ruby/library/net-http/http/start_spec.rb +++ b/spec/ruby/library/net-http/http/start_spec.rb @@ -22,13 +22,13 @@ describe "Net::HTTP.start" do end it "returns a new Net::HTTP object for the passed address and port" do - @http.should be_kind_of(Net::HTTP) + @http.should.is_a?(Net::HTTP) @http.address.should == "localhost" @http.port.should == @port end it "opens the tcp connection" do - @http.started?.should be_true + @http.started?.should == true end end @@ -41,19 +41,19 @@ describe "Net::HTTP.start" do yielded = false Net::HTTP.start("localhost", @port) do |net| yielded = true - net.should be_kind_of(Net::HTTP) + net.should.is_a?(Net::HTTP) end - yielded.should be_true + yielded.should == true end it "opens the tcp connection before yielding" do - Net::HTTP.start("localhost", @port) { |http| http.started?.should be_true } + Net::HTTP.start("localhost", @port) { |http| http.started?.should == true } end it "closes the tcp connection after yielding" do net = nil Net::HTTP.start("localhost", @port) { |x| net = x } - net.started?.should be_false + net.started?.should == false end end end @@ -70,18 +70,18 @@ describe "Net::HTTP#start" do end it "returns self" do - @http.start.should equal(@http) + @http.start.should.equal?(@http) end it "opens the tcp connection" do @http.start - @http.started?.should be_true + @http.started?.should == true end describe "when self has already been started" do it "raises an IOError" do @http.start - -> { @http.start }.should raise_error(IOError) + -> { @http.start }.should.raise(IOError) end end @@ -94,18 +94,18 @@ describe "Net::HTTP#start" do yielded = false @http.start do |http| yielded = true - http.should equal(@http) + http.should.equal?(@http) end - yielded.should be_true + yielded.should == true end it "opens the tcp connection before yielding" do - @http.start { |http| http.started?.should be_true } + @http.start { |http| http.started?.should == true } end it "closes the tcp connection after yielding" do @http.start { } - @http.started?.should be_false + @http.started?.should == false end end end diff --git a/spec/ruby/library/net-http/http/trace_spec.rb b/spec/ruby/library/net-http/http/trace_spec.rb index 9809d537c5..e0ff741b04 100644 --- a/spec/ruby/library/net-http/http/trace_spec.rb +++ b/spec/ruby/library/net-http/http/trace_spec.rb @@ -19,6 +19,6 @@ describe "Net::HTTP#trace" do end it "returns a Net::HTTPResponse" do - @http.trace("/request").should be_kind_of(Net::HTTPResponse) + @http.trace("/request").should.is_a?(Net::HTTPResponse) end end diff --git a/spec/ruby/library/net-http/http/unlock_spec.rb b/spec/ruby/library/net-http/http/unlock_spec.rb index adf0b49f65..cbfc803f09 100644 --- a/spec/ruby/library/net-http/http/unlock_spec.rb +++ b/spec/ruby/library/net-http/http/unlock_spec.rb @@ -19,6 +19,6 @@ describe "Net::HTTP#unlock" do end it "returns a Net::HTTPResponse" do - @http.unlock("/request", "test=test").should be_kind_of(Net::HTTPResponse) + @http.unlock("/request", "test=test").should.is_a?(Net::HTTPResponse) end end diff --git a/spec/ruby/library/net-http/http/use_ssl_spec.rb b/spec/ruby/library/net-http/http/use_ssl_spec.rb index 912a62a8ba..b283655359 100644 --- a/spec/ruby/library/net-http/http/use_ssl_spec.rb +++ b/spec/ruby/library/net-http/http/use_ssl_spec.rb @@ -4,6 +4,6 @@ require 'net/http' describe "Net::HTTP#use_ssl?" do it "returns false" do http = Net::HTTP.new("localhost") - http.use_ssl?.should be_false + http.use_ssl?.should == false end end diff --git a/spec/ruby/library/net-http/http/version_1_2_spec.rb b/spec/ruby/library/net-http/http/version_1_2_spec.rb index e994511aea..4918597234 100644 --- a/spec/ruby/library/net-http/http/version_1_2_spec.rb +++ b/spec/ruby/library/net-http/http/version_1_2_spec.rb @@ -6,12 +6,12 @@ describe "Net::HTTP.version_1_2" do it "turns on net/http 1.2 features" do Net::HTTP.version_1_2 - Net::HTTP.version_1_2?.should be_true - Net::HTTP.version_1_1?.should be_false + Net::HTTP.version_1_2?.should == true + Net::HTTP.version_1_1?.should == false end it "returns true" do - Net::HTTP.version_1_2.should be_true + Net::HTTP.version_1_2.should == true end end |
