diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-04-27 18:53:23 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-04-27 18:53:23 +0200 |
commit | a1b4816759418ca8fe510e8739622fc5d77ab0f0 (patch) | |
tree | 9d4fb6091d0086817f5bde46bf1150e9130d34fd /spec/ruby/library/net/http | |
parent | 00c33d9c232ed1a79eda17acd7231ac93caa162b (diff) |
Update to ruby/spec@15c9619
Diffstat (limited to 'spec/ruby/library/net/http')
-rw-r--r-- | spec/ruby/library/net/http/http/post_spec.rb | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/spec/ruby/library/net/http/http/post_spec.rb b/spec/ruby/library/net/http/http/post_spec.rb index c8d41b9617..9f20a03c85 100644 --- a/spec/ruby/library/net/http/http/post_spec.rb +++ b/spec/ruby/library/net/http/http/post_spec.rb @@ -3,40 +3,38 @@ require 'net/http' require 'uri' require_relative 'fixtures/http_server' -ruby_version_is '2.4' do - describe "Net::HTTP.post" do - before :each do - NetHTTPSpecs.start_server - end +describe "Net::HTTP.post" do + before :each do + NetHTTPSpecs.start_server + end - after :each do - NetHTTPSpecs.stop_server - end + after :each do + NetHTTPSpecs.stop_server + end - it "sends post request to the specified URI and returns response" do - response = Net::HTTP.post( - URI("http://localhost:#{NetHTTPSpecs.port}/request"), - '{ "q": "ruby", "max": "50" }', - "Content-Type" => "application/json") - response.body.should == "Request type: POST" - end + it "sends post request to the specified URI and returns response" do + response = Net::HTTP.post( + URI("http://localhost:#{NetHTTPSpecs.port}/request"), + '{ "q": "ruby", "max": "50" }', + "Content-Type" => "application/json") + response.body.should == "Request type: POST" + end - 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) - end + 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) + 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"]') - 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"]') + end - it "does not support HTTP Basic Auth" do - response = Net::HTTP.post( - URI("http://john:qwerty@localhost:#{NetHTTPSpecs.port}/request/basic_auth"), - "test=test") - response.body.should == "username: \npassword: " - end + it "does not support HTTP Basic Auth" do + response = Net::HTTP.post( + URI("http://john:qwerty@localhost:#{NetHTTPSpecs.port}/request/basic_auth"), + "test=test") + response.body.should == "username: \npassword: " end end |