Module: Test::Unit::Priority

Included in:
TestCase
Defined in:
lib/test/unit/priority.rb

Defined Under Namespace

Modules: ClassMethods Classes: Checker

Constant Summary collapse

@@enabled =
false
@@default =
:normal

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.available_valuesObject



40
41
42
# File 'lib/test/unit/priority.rb', line 40

def available_values
  Checker.available_priorities
end

.defaultObject



32
33
34
# File 'lib/test/unit/priority.rb', line 32

def default
  @@default || :normal
end

.default=(default) ⇒ Object



36
37
38
# File 'lib/test/unit/priority.rb', line 36

def default=(default)
  @@default = default
end

.disableObject



27
28
29
# File 'lib/test/unit/priority.rb', line 27

def disable
  @@enabled = false
end

.enableObject



21
22
23
24
25
# File 'lib/test/unit/priority.rb', line 21

def enable
  require "fileutils"
  require "tmpdir"
  @@enabled = true
end

.enabled?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/test/unit/priority.rb', line 17

def enabled?
  @@enabled
end

.included(base) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/test/unit/priority.rb', line 7

def included(base)
  base.extend(ClassMethods)

  base.class_eval do
    setup :priority_setup, :before => :prepend
    teardown :priority_teardown, :after => :append
  end
end

Instance Method Details

#priority_setupObject



185
186
187
188
# File 'lib/test/unit/priority.rb', line 185

def priority_setup
  return unless Priority.enabled?
  Checker.new(self).setup
end

#priority_teardownObject



190
191
192
193
# File 'lib/test/unit/priority.rb', line 190

def priority_teardown
  return unless Priority.enabled?
  Checker.new(self).teardown
end