Class: QED::Reporter::BaseClass
- Inherits:
-
Object
- Object
- QED::Reporter::BaseClass
- Defined in:
- lib/qed/reporter/base.rb
Overview
Reporter BaseClass
Serves as the base class for all other specification output formats.
Direct Known Subclasses
Constant Summary collapse
- ANSICode =
ANSI::Code
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#fail ⇒ Object
readonly
Returns the value of attribute fail.
-
#io ⇒ Object
readonly
Returns the value of attribute io.
-
#pass ⇒ Object
readonly
Returns the value of attribute pass.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ BaseClass
constructor
A new instance of BaseClass.
-
#report_comment(step) ⇒ Object
Report a comment.
-
#report_end(spec) ⇒ Object
End of a specification.
-
#report_error(step, exception) ⇒ Object
Report step raised an error.
-
#report_fail(step, assertion) ⇒ Object
Report step failed.
-
#report_header(step) ⇒ Object
Report a header.
-
#report_intro ⇒ Object
Before running any specifications.
-
#report_macro(step) ⇒ Object
Since regular macro step does not pass or fail, this method is used instead.
-
#report_omit(step) ⇒ Object
Report on omitted step.
-
#report_pass(step) ⇒ Object
Report step passed.
-
#report_start(spec) ⇒ Object
Beginning of a specification.
-
#report_step(step) ⇒ Object
Before running a step.
-
#report_step_end(step) ⇒ Object
After running a step.
-
#report_summary ⇒ Object
After running all specifications.
- #verbose? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ BaseClass
Returns a new instance of BaseClass.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/qed/reporter/base.rb', line 22 def initialize(={}) @io = [:io] || STDOUT @verbose = [:verbose] @demos = 0 @steps = 0 @pass = [] @fail = [] @error = [] end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
20 21 22 |
# File 'lib/qed/reporter/base.rb', line 20 def error @error end |
#fail ⇒ Object (readonly)
Returns the value of attribute fail.
19 20 21 |
# File 'lib/qed/reporter/base.rb', line 19 def fail @fail end |
#io ⇒ Object (readonly)
Returns the value of attribute io.
16 17 18 |
# File 'lib/qed/reporter/base.rb', line 16 def io @io end |
#pass ⇒ Object (readonly)
Returns the value of attribute pass.
18 19 20 |
# File 'lib/qed/reporter/base.rb', line 18 def pass @pass end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
17 18 19 |
# File 'lib/qed/reporter/base.rb', line 17 def steps @steps end |
Instance Method Details
#report_comment(step) ⇒ Object
Report a comment.
52 53 |
# File 'lib/qed/reporter/base.rb', line 52 def report_comment(step) end |
#report_end(spec) ⇒ Object
End of a specification.
97 98 |
# File 'lib/qed/reporter/base.rb', line 97 def report_end(spec) end |
#report_error(step, exception) ⇒ Object
Report step raised an error.
76 77 78 79 |
# File 'lib/qed/reporter/base.rb', line 76 def report_error(step, exception) raise exception if $DEBUG @error << [step, exception] end |
#report_fail(step, assertion) ⇒ Object
Report step failed.
71 72 73 |
# File 'lib/qed/reporter/base.rb', line 71 def report_fail(step, assertion) @fail << [step, assertion] end |
#report_header(step) ⇒ Object
Report a header.
48 49 |
# File 'lib/qed/reporter/base.rb', line 48 def report_header(step) end |
#report_intro ⇒ Object
Before running any specifications.
39 40 |
# File 'lib/qed/reporter/base.rb', line 39 def report_intro end |
#report_macro(step) ⇒ Object
Since regular macro step does not pass or fail, this method is used instead.
TODO: Rename to #report_nominal (?)
85 86 |
# File 'lib/qed/reporter/base.rb', line 85 def report_macro(step) end |
#report_omit(step) ⇒ Object
Report on omitted step.
89 90 |
# File 'lib/qed/reporter/base.rb', line 89 def report_omit(step) end |
#report_pass(step) ⇒ Object
Report step passed.
66 67 68 |
# File 'lib/qed/reporter/base.rb', line 66 def report_pass(step) @pass << step end |
#report_start(spec) ⇒ Object
Beginning of a specification.
43 44 45 |
# File 'lib/qed/reporter/base.rb', line 43 def report_start(spec) @demos += 1 end |
#report_step(step) ⇒ Object
Before running a step.
61 62 63 |
# File 'lib/qed/reporter/base.rb', line 61 def report_step(step) @steps += 1 end |
#report_step_end(step) ⇒ Object
After running a step.
93 94 |
# File 'lib/qed/reporter/base.rb', line 93 def report_step_end(step) end |
#report_summary ⇒ Object
After running all specifications.
101 102 |
# File 'lib/qed/reporter/base.rb', line 101 def report_summary end |
#verbose? ⇒ Boolean
34 35 36 |
# File 'lib/qed/reporter/base.rb', line 34 def verbose? @verbose end |