Class: EventMachine::Ventually::Eventually::TestUnit

Inherits:
EventMachine::Ventually::Eventually show all
Defined in:
lib/em-ventually/eventually/testunit.rb

Instance Attribute Summary

Attributes inherited from EventMachine::Ventually::Eventually

#expectation

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from EventMachine::Ventually::Eventually

#formatted_message, #initialize, #kill_timer, #process_test, #run, #stop, #test

Constructor Details

This class inherits a constructor from EventMachine::Ventually::Eventually

Class Method Details

.injectObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/em-ventually/eventually/testunit.rb', line 5

def self.inject
  unless ::Test::Unit::TestCase.public_method_defined?(:_em)
    ::Test::Unit::TestCase.class_eval <<-EOT, __FILE__, __LINE__ + 1
    include EM::Ventually::Emify
    alias_method :__original__send__, :__send__
    old_warning_level = $VERBOSE
    $VERBOSE = nil
    def __send__(*args, &blk)
      if Callsite.parse(caller.first).method == 'run'
        _em { __original__send__(*args, &blk) }
      else
        __original__send__(*args, &blk)
      end
    end
    $VERBOSE = old_warning_level
    EOT
  end
end

Instance Method Details

#assert_test(result) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/em-ventually/eventually/testunit.rb', line 28

def assert_test(result)
  e = expectation
  if super
    msg = formatted_message("#{result.inspect} passed")
    @runner.instance_eval do
      assert true, msg
    end
    true
  else
    false
  end
end

#report(msg) ⇒ Object



24
25
26
# File 'lib/em-ventually/eventually/testunit.rb', line 24

def report(msg)
  @runner.assert false, msg
end