Class: Assert::Runner
- Inherits:
-
Object
- Object
- Assert::Runner
- Includes:
- ConfigHelpers
- Defined in:
- lib/assert/runner.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Methods included from ConfigHelpers
#all_pass?, #count, #ocurring_result_types, #ordered_suite_contexts, #ordered_suite_files, #result_rate, #run_time, #runner_seed, #show_test_profile_info?, #show_test_verbose_info?, #suite_contexts, #suite_files, #test_rate, #tests?
Constructor Details
#initialize(config) ⇒ Runner
Returns a new instance of Runner.
11 12 13 |
# File 'lib/assert/runner.rb', line 11 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/assert/runner.rb', line 9 def config @config end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/assert/runner.rb', line 15 def run suite, view = @config.suite, @config.view raise ArgumentError if !suite.kind_of?(Suite) if tests? view.puts "Running tests in random order, seeded with \"#{runner_seed}\"" end view.fire(:on_start) begin suite.setup suite.start_time = Time.now tests_to_run(suite).each do |test| view.fire(:before_test, test) test.run{ |result| view.fire(:on_result, result) } view.fire(:after_test, test) end suite.end_time = Time.now suite.teardown rescue Interrupt => err view.fire(:on_interrupt, err) raise(err) end view.fire(:on_finish) suite.count(:failed) + suite.count(:errored) end |