File: client_fiber_spec.rb

package info (click to toggle)
ruby-em-http-request 1.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 628 kB
  • ctags: 243
  • sloc: ruby: 3,478; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 558 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'helper'
require 'fiber'

describe EventMachine::HttpRequest do
  context "with fibers" do

    it "should be transparent to connection errors" do
      EventMachine.run do
        Fiber.new do
          f = Fiber.current
          fired = false
          http = EventMachine::HttpRequest.new('http://non-existing.domain/', :connection_timeout => 0.1).get
          http.callback { failed(http) }
          http.errback { f.resume :errback }

          Fiber.yield.should == :errback
          EM.stop
        end.resume
      end
    end

  end
end