@@ -35,24 +35,31 @@ class Runner
3535 # instance with, or a name of a configuration profile.
3636 #
3737 # @return [Boolean] Success of test run.
38- def self . run ( config = nil ) #:yield:
39- case config
40- when Config
41- when Hash
42- config = Config . new ( config )
43- else
44- config = Test . configuration ( config )
45- end
46-
47- yeild ( config ) if block_given?
48-
49- runner = Runner . new ( config )
38+ def self . run ( config = nil , &config_proc ) #:yield:
39+ runner = Runner . new ( config , &config_proc )
5040 runner . run
5141 end
5242
5343 # Exceptions that are not caught by test runner.
5444 OPEN_ERRORS = [ NoMemoryError , SignalException , Interrupt , SystemExit ]
5545
46+ # New Runner.
47+ #
48+ # @param [Config] config
49+ # Config instance.
50+ #
51+ def initialize ( config ) #:yield:
52+ @config = case config
53+ when Config then config
54+ when Hash then Config . new ( config )
55+ else Test . configuration ( config )
56+ end
57+
58+ yeild ( @config ) if block_given?
59+
60+ @advice = Advice . new
61+ end
62+
5663 # Handle all configuration via the config instance.
5764 attr :config
5865
@@ -102,16 +109,6 @@ def upon(type, &block)
102109 advice . join ( type , &block )
103110 end
104111
105- # New Runner.
106- #
107- # @param [Config] config
108- # Config instance.
109- #
110- def initialize ( config )
111- @config = config
112- @advice = Advice . new
113- end
114-
115112 # The reporter to use for ouput.
116113 attr :reporter
117114
0 commit comments