Class: Smartest::Runner
- Inherits:
-
Object
- Object
- Smartest::Runner
- Defined in:
- lib/smartest/runner.rb
Instance Method Summary collapse
-
#initialize(suite: Smartest.suite, reporter: Reporter.new, tests: nil) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(suite: Smartest.suite, reporter: Reporter.new, tests: nil) ⇒ Runner
Returns a new instance of Runner.
5 6 7 8 9 |
# File 'lib/smartest/runner.rb', line 5 def initialize(suite: Smartest.suite, reporter: Reporter.new, tests: nil) @suite = suite @reporter = reporter @tests = tests || suite.tests end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/smartest/runner.rb', line 11 def run results = [] suite_cleanup_errors = [] @suite_fixture_set = nil @reporter.start(@tests.count) begin @tests.each do |test_case| result = run_one(test_case) results << result @reporter.record(result) end ensure suite_cleanup_errors = @suite_fixture_set.run_cleanups if @suite_fixture_set @suite_fixture_set = nil end @reporter.finish(results, suite_cleanup_errors: suite_cleanup_errors) results.any?(&:failed?) || suite_cleanup_errors.any? ? 1 : 0 end |