spec/external_spec.rb in em-http-request-1.0.0.beta.3 vs spec/external_spec.rb in em-http-request-1.0.0.beta.4
- old
+ new
@@ -77,19 +77,35 @@
EventMachine.stop
}
}
end
+ it "should detect deflate encoding" do
+ EventMachine.run {
+
+ options = {:head => {"accept-encoding" => "deflate"}, :redirects => 5}
+ http = EventMachine::HttpRequest.new('http://www.msn.com').get options
+
+ http.errback { failed(http) }
+ http.callback {
+ http.response_header.status.should == 200
+ http.response_header["CONTENT_ENCODING"].should == "deflate"
+
+ EventMachine.stop
+ }
+ }
+ end
+
context "keepalive" do
it "should default to non-keepalive" do
EventMachine.run {
headers = {'If-Modified-Since' => 'Thu, 05 Aug 2010 22:54:44 GMT'}
http = EventMachine::HttpRequest.new('http://www.google.com/images/logos/ps_logo2.png').get :head => headers
http.errback { fail }
start = Time.now.to_i
http.callback {
- (start - Time.now.to_i).should be_within(1).of(0)
+ (Time.now.to_i - start).should be_within(2).of(0)
EventMachine.stop
}
}
end