spec/wasabi/resolver_spec.rb in wasabi-3.0.0 vs spec/wasabi/resolver_spec.rb in wasabi-3.1.0
- old
+ new
@@ -16,8 +16,25 @@
it "simply returns raw XML" do
xml = Wasabi::Resolver.new("<xml/>").resolve
xml.should == "<xml/>"
end
+
+ it "raises HTTPError when #load_from_remote gets a response error" do
+ code = 404
+ headers = {
+ "content-type" => "text/html"
+ }
+ body = "<html><head><title>404 Not Found</title></head><body>Oops!</body></html>"
+ failed_response = HTTPI::Response.new(code, headers, body)
+ HTTPI.stub(:get => failed_response)
+ lambda do
+ Wasabi::Resolver.new("http://example.com?wsdl").resolve
+ end.should raise_error { |ex|
+ ex.should be_a(Wasabi::Resolver::HTTPError)
+ ex.message.should == "Error: #{code}"
+ ex.response.should == failed_response
+ }
+ end
end
end