Class: Oncall::Reporter
- Inherits:
-
Object
- Object
- Oncall::Reporter
- Defined in:
- lib/oncall/reporter.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
Returns the value of attribute results.
Instance Method Summary collapse
- #empty_call(test_case) ⇒ Object
- #empty_group(test_case) ⇒ Object
-
#initialize ⇒ Reporter
constructor
A new instance of Reporter.
- #json_schema(test_case, result, expected) ⇒ Object
- #report ⇒ Object
- #status(test_case, result, expected) ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize ⇒ Reporter
Returns a new instance of Reporter.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/oncall/reporter.rb', line 7 def initialize @messages = [] @start_time = nil @end_time = nil @results = { success: 0, failed: 0, warn: 0, skipped: 0 } end |
Instance Attribute Details
#results ⇒ Object
Returns the value of attribute results.
5 6 7 |
# File 'lib/oncall/reporter.rb', line 5 def results @results end |
Instance Method Details
#empty_call(test_case) ⇒ Object
33 34 35 36 |
# File 'lib/oncall/reporter.rb', line 33 def empty_call(test_case) add_skipped report_empty_call end |
#empty_group(test_case) ⇒ Object
28 29 30 31 |
# File 'lib/oncall/reporter.rb', line 28 def empty_group(test_case) add_warn report_empty_group end |
#json_schema(test_case, result, expected) ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/oncall/reporter.rb', line 49 def json_schema(test_case, result, expected) if result add_success report_success else add_failed report_failure @messages << "#{test_case.to_s}: JSON schema didn't match:\n#{expected}" end end |
#report ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/oncall/reporter.rb', line 19 def report start begin yield self ensure finish end end |
#status(test_case, result, expected) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/oncall/reporter.rb', line 38 def status(test_case, result, expected) if result add_success report_success else add_failed report_failure @messages << "#{test_case.to_s}: Expected status: #{expected}" end end |
#success? ⇒ Boolean
60 61 62 |
# File 'lib/oncall/reporter.rb', line 60 def success? @results[:failed].zero? end |