test-unit/lib/test/unit/priority.rb in activeldap-1.0.2 vs test-unit/lib/test/unit/priority.rb in activeldap-1.0.9

- old
+ new

@@ -24,25 +24,45 @@ end def disable @@enabled = false end + + @@default = :normal + def default + @@default || :normal + end + + def default=(default) + @@default = default + end + + def available_values + Checker.available_priorities + end end class Checker class << self def have_priority?(name) singleton_class = (class << self; self; end) singleton_class.method_defined?(priority_check_method_name(name)) end def need_to_run?(test) - priority = test[:priority] || :normal + priority = test[:priority] || Priority.default if have_priority?(priority) send(priority_check_method_name(priority), test) else true end + end + + def available_priorities + methods(false).collect do |name| + /\Arun_priority_(.+)\?\z/ =~ name.to_s + $1 + end.compact end def run_priority_must?(test) true end