spec/http2_spec.rb in http2-0.0.32 vs spec/http2_spec.rb in http2-0.0.33
- old
+ new
@@ -24,11 +24,11 @@
{
"val8" => "test8"
}
]
},
- "val9" => ["a", "b", "d"]
+ "val9" => %w[a b d]
}
)
res = JSON.parse(resp.body)
expect(res.is_a?(Hash)).to eq true
@@ -98,15 +98,10 @@
expect(res.body.to_s.length).to be > 0
end
end
end
- it "should be able to convert URL's to 'is.gd'-short-urls" do
- isgd = Http2.isgdlink("https://github.com/kaspernj/http2")
- raise "Expected isgd-var to be valid but it wasnt: '#{isgd}'." unless isgd.match(/^http:\/\/is\.gd\/([A-z\d]+)$/)
- end
-
it "should raise exception 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
@@ -157,8 +152,24 @@
it "should follow redirects" do
with_http(follow_redirects: true) do |http|
resp = http.get("redirect_test.rhtml")
expect(resp.code).to eq "200"
+ end
+ end
+
+ it "throws errors on unauhtorized" do
+ with_http do |http|
+ expect do
+ http.get("unauthorized.rhtml")
+ end.to raise_error(Http2::Errors::Unauthorized)
+ end
+ end
+
+ it "throws errors on unsupported media type" do
+ with_http do |http|
+ expect do
+ http.get("unsupported_media_type.rhtml")
+ end.to raise_error(Http2::Errors::UnsupportedMediaType)
end
end
end