Class: Test::Unit::TestSuite

Inherits:
Object
  • Object
show all
Defined in:
lib/test-unit-ext/priority.rb

Constant Summary collapse

@@priority_mode =
false

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.priority_mode=(bool) ⇒ Object



148
149
150
# File 'lib/test-unit-ext/priority.rb', line 148

def priority_mode=(bool)
  @@priority_mode = bool
end

Instance Method Details

#apply_priorityObject



165
166
167
# File 'lib/test-unit-ext/priority.rb', line 165

def apply_priority
  @tests = @tests.reject {|test| !test.need_to_run?}
end

#need_to_run?Boolean

Returns:

  • (Boolean)


169
170
171
172
# File 'lib/test-unit-ext/priority.rb', line 169

def need_to_run?
  apply_priority
  !@tests.empty?
end

#original_runObject



153
# File 'lib/test-unit-ext/priority.rb', line 153

alias_method :original_run, :run

#run(*args, &block) ⇒ Object



154
155
156
157
158
159
160
161
162
163
# File 'lib/test-unit-ext/priority.rb', line 154

def run(*args, &block)
  priority_mode = @@priority_mode
  if priority_mode
    @original_tests = @tests
    apply_priority
  end
  original_run(*args, &block)
ensure
  @tests = @original_tests if priority_mode
end