Class: Test::Unit::TestSuite

Inherits:
Object
  • Object
show all
Defined in:
lib/running_man/block.rb

Instance Method Summary collapse

Instance Method Details

#run(result) {|STARTED, name| ... } ⇒ Object

:nodoc:

Yields:

  • (STARTED, name)


113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/running_man/block.rb', line 113

def run(result, &progress_block) # :nodoc:
  yield(STARTED, name)
  klass_to_teardown = if @tests.first.is_a?(Test::Unit::TestCase)
    @tests.first.class
  end
  @tests.each do |test|
    test.run(result, &progress_block)
  end
  if klass_to_teardown
    klass_to_teardown.final_teardowns.each do |teardown|
      begin
        teardown.run(@tests.last)
      rescue
        puts "#{$!.class} on #{klass_to_teardown} teardown: #{$!}"
        $!.backtrace { |b| puts ">> #{b}" }
      end
    end
  end
  yield(FINISHED, name)
end