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



592
593
594
# File 'lib/test/spec.rb', line 592

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

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

Yields:

  • (STARTED, name)


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

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



586
587
588
589
590
# File 'lib/test/spec.rb', line 586

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