Class: Test::Unit::TestSuite

Inherits:
Object
  • Object
show all
Defined in:
lib/test/spec.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#positionObject



643
644
645
# File 'lib/test/spec.rb', line 643

def position
  @tests.first.respond_to?(:position) ? @tests.first.position : 0
end

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

Yields:

  • (STARTED, name)


624
625
626
627
628
629
630
631
632
633
634
635
# File 'lib/test/spec.rb', line 624

def run(result, &progress_block)
  sort!
  
  yield(STARTED, name)
  
  @tests.first.before_all  if @tests.first.respond_to? :before_all
  @tests.each do |test|
    test.run(result, &progress_block)
  end
  @tests.last.after_all  if @tests.last.respond_to? :after_all
  yield(FINISHED, name)
end

#sort!Object



637
638
639
640
641
# File 'lib/test/spec.rb', line 637

def sort!
  @tests = @tests.sort_by { |test|
    test.respond_to?(:position) ? test.position : 0
  }
end