Module: EventMachine::Test

Defined in:
lib/em-test.rb,
lib/em-test/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.included(cls) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/em-test.rb', line 77

def self.included(cls)
  cls.class_eval(<<-HERE_DOC, __FILE__, __LINE__)
    include TestHelper

    alias_method :run_without_em, :run
    def run(result, &block)
      em(DefaultTimeout) { run_without_em(result, &block) }
    rescue Exception => e
      if RUBY_VERSION >= "1.9.1"
        result.puke(self.class, @name, e)
      else
        add_error($!)
      end
    end

  HERE_DOC
end