spec/http2_spec.rb in http2-0.0.35 vs spec/http2_spec.rb in http2-0.0.36
- old
+ new
@@ -1,10 +1,10 @@
require "spec_helper"
require "json"
describe "Http2" do
- it "should be able to do normal post-requests." do
+ it "does normal post-requests" do
# Test posting keep-alive and advanced post-data.
with_http do |http|
0.upto(5) do
http.get("multipart_test.rhtml")
@@ -42,21 +42,23 @@
expect(res["val9"]["2"]).to eq "d"
end
end
end
- it "#reconnect" do
- with_http(follow_redirects: false, encoding_gzip: false) do |http|
- resp1 = http.get("multipart_test.rhtml")
- http.reconnect
- resp2 = http.get("multipart_test.rhtml")
+ describe "#reconnect" do
+ it "reconnects" do
+ with_http(follow_redirects: false, encoding_gzip: false) do |http|
+ resp1 = http.get("multipart_test.rhtml")
+ http.reconnect
+ resp2 = http.get("multipart_test.rhtml")
- expect(resp1.body).to eq resp2.body
+ expect(resp1.body).to eq resp2.body
+ end
end
end
- it "should be able to do multipart-requests and keep-alive when using multipart." do
+ it "handles multipart-requests and keep-alive when using multipart." do
with_http(follow_redirects: false) do |http|
0.upto(5) do
fpath = File.realpath(__FILE__)
fpath2 = "#{File.realpath(File.dirname(__FILE__))}/../lib/http2.rb"
@@ -82,11 +84,11 @@
expect(data["files_data"]["test_file2"]).to eq File.read(fpath2)
end
end
end
- it "it should be able to handle keep-alive correctly" do
+ it "handles keep-alive correctly" do
urls = [
"content_type_test.rhtml",
"json_test.rhtml"
]
@@ -98,17 +100,17 @@
expect(res.body.to_s.length).to be > 0
end
end
end
- it "should raise exception when something is not found" do
+ it "raises an error when something is not found" do
with_http do |http|
expect { http.get("something_that_does_not_exist.rhtml") }.to raise_error(::Http2::Errors::Notfound)
end
end
- it "should be able to post json" do
+ it "posts json" do
with_http do |http|
res = http.post(
url: "json_test.rhtml",
json: {testkey: "testvalue"}
)
@@ -124,11 +126,11 @@
expect(res.json?).to eq true
expect(res.json["_SERVER"]["REQUEST_METHOD"]).to eq "POST"
end
end
- it "should be able to post custom content types" do
+ it "posts custom content types" do
with_http do |http|
res = http.post(
url: "content_type_test.rhtml",
content_type: "plain/text",
post: "test1_test2_test3"
@@ -140,18 +142,18 @@
raw_data = data["_POST"].keys.first
expect(raw_data).to eq "test1_test2_test3"
end
end
- it "should set various timeouts" do
+ it "sets various timeouts" do
with_http do |http|
http.get("content_type_test.rhtml")
expect(http.keepalive_timeout).to eq 15
expect(http.keepalive_max).to eq 30
end
end
- it "should follow redirects" do
+ it "follows redirects" do
with_http(follow_redirects: true) do |http|
resp = http.get("redirect_test.rhtml")
expect(resp.code).to eq "200"
end
end