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



38
39
40
# File 'lib/test/unit/priority.rb', line 38

def available_values
  Checker.available_priorities
end

.defaultObject



30
31
32
# File 'lib/test/unit/priority.rb', line 30

def default
  @@default || :normal
end

.default=(default) ⇒ Object



34
35
36
# File 'lib/test/unit/priority.rb', line 34

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

.disableObject



25
26
27
# File 'lib/test/unit/priority.rb', line 25

def disable
  @@enabled = false
end

.enableObject



19
20
21
22
23
# File 'lib/test/unit/priority.rb', line 19

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

.enabled?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/test/unit/priority.rb', line 15

def enabled?
  @@enabled
end

.included(base) ⇒ Object



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

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_setup(&_) ⇒ Object



183
184
185
186
# File 'lib/test/unit/priority.rb', line 183

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

#priority_teardownObject



188
189
190
191
# File 'lib/test/unit/priority.rb', line 188

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