spec/http_spec.rb in em-synchrony-0.2.0 vs spec/http_spec.rb in em-synchrony-0.3.0.beta.1
- old
+ new
@@ -2,9 +2,21 @@
URL = "http://localhost:8081/"
DELAY = 0.25
describe EventMachine::HttpRequest do
+ it "should perform a synchronous fetch" do
+ EM.synchrony do
+ s = StubServer.new("HTTP/1.0 200 OK\r\nConnection: close\r\n\r\nFoo", DELAY)
+
+ r = EventMachine::HttpRequest.new(URL).get
+ r.response.should == 'Foo'
+
+ s.stop
+ EventMachine.stop
+ end
+ end
+
it "should fire sequential requests" do
EventMachine.synchrony do
s = StubServer.new("HTTP/1.0 200 OK\r\nConnection: close\r\n\r\nFoo", DELAY)
start = now