Class: FunWith::Gems::TestResults
- Inherits:
-
Object
- Object
- FunWith::Gems::TestResults
- Defined in:
- lib/fun_with/gems/test_results.rb
Constant Summary collapse
- TEST_SUITE_DATA_REGEX =
/(?<tests>\d+) (?:tests|runs), (?<assertions>\d+) assertions, (?<failures>\d+) failures, (?<errors>\d+) errors, (?<skips>\d+) skips/
Instance Attribute Summary collapse
-
#fail_count ⇒ Object
Returns the value of attribute fail_count.
-
#gem_const ⇒ Object
Returns the value of attribute gem_const.
-
#output ⇒ Object
Returns the value of attribute output.
-
#test_results_found ⇒ Object
Returns the value of attribute test_results_found.
Instance Method Summary collapse
-
#initialize(g) ⇒ TestResults
constructor
A new instance of TestResults.
- #no_failures_or_errors? ⇒ Boolean
- #passed? ⇒ Boolean
- #scan_test_results ⇒ Object
- #test_results_found? ⇒ Boolean
Constructor Details
#initialize(g) ⇒ TestResults
Returns a new instance of TestResults.
8 9 10 |
# File 'lib/fun_with/gems/test_results.rb', line 8 def initialize g self.gem_const = g end |
Instance Attribute Details
#fail_count ⇒ Object
Returns the value of attribute fail_count.
6 7 8 |
# File 'lib/fun_with/gems/test_results.rb', line 6 def fail_count @fail_count end |
#gem_const ⇒ Object
Returns the value of attribute gem_const.
6 7 8 |
# File 'lib/fun_with/gems/test_results.rb', line 6 def gem_const @gem_const end |
#output ⇒ Object
Returns the value of attribute output.
6 7 8 |
# File 'lib/fun_with/gems/test_results.rb', line 6 def output @output end |
#test_results_found ⇒ Object
Returns the value of attribute test_results_found.
6 7 8 |
# File 'lib/fun_with/gems/test_results.rb', line 6 def test_results_found @test_results_found end |
Instance Method Details
#no_failures_or_errors? ⇒ Boolean
21 22 23 |
# File 'lib/fun_with/gems/test_results.rb', line 21 def no_failures_or_errors? fail_count == 0 end |
#passed? ⇒ Boolean
12 13 14 15 |
# File 'lib/fun_with/gems/test_results.rb', line 12 def passed? self.scan_test_results self.test_results_found? && no_failures_or_errors? end |
#scan_test_results ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fun_with/gems/test_results.rb', line 25 def scan_test_results raise "No output to scan!" if self.output.nil? if m = self.output.match( TEST_SUITE_DATA_REGEX ) self.test_results_found = true self.fail_count = m[:failures].to_i + m[:errors].to_i else self.fail_count = -1 self.test_results_found = false end end |
#test_results_found? ⇒ Boolean
17 18 19 |
# File 'lib/fun_with/gems/test_results.rb', line 17 def test_results_found? self.test_results_found end |