Sha256: 288febab1154e01bdf231e8ac324ab2ed8e5591d26ad2fd5e7a86bff78686461
Contents?: true
Size: 793 Bytes
Versions: 9
Compression:
Stored size: 793 Bytes
Contents
require "spec/helper/all" require "em-synchrony/iterator" describe EventMachine::Synchrony do URL = "http://localhost:8081/" DELAY = 0.01 it "should allow inline callbacks for Deferrable object" do EM.synchrony do s = StubServer.new("HTTP/1.0 200 OK\r\nConnection: close\r\n\r\nFoo", DELAY) result = EM::Synchrony.sync EventMachine::HttpRequest.new(URL).aget result.response.should match(/Foo/) EM.stop end end it "should inline errback/callback cases" do EM.synchrony do class E include EventMachine::Deferrable def run EM.add_timer(0.01) {fail("uh oh!")} self end end result = EM::Synchrony.sync E.new.run result.should match(/uh oh!/) EM.stop end end end
Version data entries
9 entries across 9 versions & 1 rubygems