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



590
591
592
# File 'lib/test/spec.rb', line 590

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

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

Yields:

  • (STARTED, name)


573
574
575
576
577
578
579
580
581
582
# File 'lib/test/spec.rb', line 573

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



584
585
586
587
588
# File 'lib/test/spec.rb', line 584

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