Class: Webspicy::Tester::Reporter::Summary
- Inherits:
-
Webspicy::Tester::Reporter
- Object
- Webspicy::Tester::Reporter
- Webspicy::Tester::Reporter::Summary
- Defined in:
- lib/webspicy/tester/reporter/summary.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Webspicy::Tester::Reporter
Instance Attribute Summary collapse
-
#assertions_count ⇒ Object
readonly
Returns the value of attribute assertions_count.
-
#counterexamples_count ⇒ Object
readonly
Returns the value of attribute counterexamples_count.
-
#errors_count ⇒ Object
readonly
Returns the value of attribute errors_count.
-
#examples_count ⇒ Object
readonly
Returns the value of attribute examples_count.
-
#failures_count ⇒ Object
readonly
Returns the value of attribute failures_count.
-
#spec_file_errors_count ⇒ Object
readonly
Returns the value of attribute spec_file_errors_count.
-
#spec_files_count ⇒ Object
readonly
Returns the value of attribute spec_files_count.
Attributes inherited from Webspicy::Tester::Reporter
Instance Method Summary collapse
- #before_spec_file ⇒ Object
-
#initialize(*args, &bl) ⇒ Summary
constructor
A new instance of Summary.
- #report ⇒ Object
- #spec_file_error(e) ⇒ Object
- #success? ⇒ Boolean
- #test_case_done ⇒ Object
- #total_error_count ⇒ Object
Methods inherited from Webspicy::Tester::Reporter
Methods included from Support::Colorize
colorize, colorize_error, colorize_highlight, colorize_section, colorize_success
Constructor Details
#initialize(*args, &bl) ⇒ Summary
Returns a new instance of Summary.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 6 def initialize(*args, &bl) super @spec_files_count = 0 @examples_count = 0 @counterexamples_count = 0 @assertions_count = 0 # @spec_file_errors_count = 0 @errors_count = 0 @failures_count = 0 end |
Instance Attribute Details
#assertions_count ⇒ Object (readonly)
Returns the value of attribute assertions_count.
18 19 20 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 18 def assertions_count @assertions_count end |
#counterexamples_count ⇒ Object (readonly)
Returns the value of attribute counterexamples_count.
17 18 19 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 17 def counterexamples_count @counterexamples_count end |
#errors_count ⇒ Object (readonly)
Returns the value of attribute errors_count.
19 20 21 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 19 def errors_count @errors_count end |
#examples_count ⇒ Object (readonly)
Returns the value of attribute examples_count.
17 18 19 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 17 def examples_count @examples_count end |
#failures_count ⇒ Object (readonly)
Returns the value of attribute failures_count.
19 20 21 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 19 def failures_count @failures_count end |
#spec_file_errors_count ⇒ Object (readonly)
Returns the value of attribute spec_file_errors_count.
19 20 21 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 19 def spec_file_errors_count @spec_file_errors_count end |
#spec_files_count ⇒ Object (readonly)
Returns the value of attribute spec_files_count.
17 18 19 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 17 def spec_files_count @spec_files_count end |
Instance Method Details
#before_spec_file ⇒ Object
21 22 23 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 21 def before_spec_file @spec_files_count += 1 end |
#report ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 40 def report msg = "#{plural('spec file', spec_files_count)}, "\ "#{plural('example', examples_count)}, "\ "#{plural('counterexample', counterexamples_count)}\n"\ "#{plural('assertion', assertions_count)}, "\ "#{plural('error', errors_count)}, "\ "#{plural('failure', failures_count)}" if success? msg = colorize_success(msg, config) else msg = colorize_error(msg, config) end io.puts(msg) io.puts io.flush end |
#spec_file_error(e) ⇒ Object
25 26 27 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 25 def spec_file_error(e) @spec_file_errors_count += 1 end |
#success? ⇒ Boolean
61 62 63 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 61 def success? total_error_count == 0 end |
#test_case_done ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 29 def test_case_done if tester.test_case.counterexample? @counterexamples_count += 1 else @examples_count += 1 end @assertions_count += tester.result.assertions_count @errors_count += tester.result.errors_count @failures_count += tester.result.failures_count end |
#total_error_count ⇒ Object
57 58 59 |
# File 'lib/webspicy/tester/reporter/summary.rb', line 57 def total_error_count @spec_file_errors_count + @errors_count + @failures_count end |