Sha256: e670975cacc862cc7a4c9f0d16945f67e020a11b2cb4264299bf7d836f77cdce
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
require 'helper' describe ZMachine::HttpRequest do it "should fail gracefully on an invalid host in Location header" do ZMachine.run { http = ZMachine::HttpRequest.new('http://127.0.0.1:8090/redirect/badhost', :connect_timeout => 0.1).get :redirects => 1 http.callback { failed(http) } http.errback { http.error.should match('unable to resolve server address') ZMachine.stop } } end # BB: 127.1.1.1 actually loops back, and if you have some process listening # on port 80 this spec fails *facepalm* # also this does not check any DNS timeout, but a connect timeout ... it "should fail GET on DNS timeout" do ZMachine.run { ZMachine.heartbeat_interval = 0.1 http = ZMachine::HttpRequest.new('http://127.1.1.1:1/', :connect_timeout => 0.1).get http.callback { failed(http) } http.errback { http.response_header.status.should == 0 ZMachine.stop } } end it "should fail GET on invalid host" do ZMachine.run { ZMachine.heartbeat_interval = 0.1 http = ZMachine::HttpRequest.new('http://somethinglocal/', :connect_timeout => 0.1).get http.callback { failed(http) } http.errback { http.error.should match(/unable to resolve server address/) http.response_header.status.should == 0 ZMachine.stop } } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
z-http-request-0.2.0 | spec/dns_spec.rb |
z-http-request-0.1.0 | spec/dns_spec.rb |