Class: FunWith::Gems::Testing::TestResults
- Inherits:
-
Object
- Object
- FunWith::Gems::Testing::TestResults
- Defined in:
- lib/fun_with/gems/testing/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.
9 10 11 |
# File 'lib/fun_with/gems/testing/test_results.rb', line 9 def initialize g self.gem_const = g end |
Instance Attribute Details
#fail_count ⇒ Object
Returns the value of attribute fail_count.
7 8 9 |
# File 'lib/fun_with/gems/testing/test_results.rb', line 7 def fail_count @fail_count end |
#gem_const ⇒ Object
Returns the value of attribute gem_const.
7 8 9 |
# File 'lib/fun_with/gems/testing/test_results.rb', line 7 def gem_const @gem_const end |
#output ⇒ Object
Returns the value of attribute output.
7 8 9 |
# File 'lib/fun_with/gems/testing/test_results.rb', line 7 def output @output end |
#test_results_found ⇒ Object
Returns the value of attribute test_results_found.
7 8 9 |
# File 'lib/fun_with/gems/testing/test_results.rb', line 7 def test_results_found @test_results_found end |
Instance Method Details
#no_failures_or_errors? ⇒ Boolean
22 23 24 |
# File 'lib/fun_with/gems/testing/test_results.rb', line 22 def no_failures_or_errors? fail_count == 0 end |
#passed? ⇒ Boolean
13 14 15 16 |
# File 'lib/fun_with/gems/testing/test_results.rb', line 13 def passed? self.scan_test_results self.test_results_found? && no_failures_or_errors? end |
#scan_test_results ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fun_with/gems/testing/test_results.rb', line 26 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
18 19 20 |
# File 'lib/fun_with/gems/testing/test_results.rb', line 18 def test_results_found? self.test_results_found end |