Class: Riot::Reporter
Direct Known Subclasses
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#failures ⇒ Object
Returns the value of attribute failures.
-
#passes ⇒ Object
Returns the value of attribute passes.
Instance Method Summary collapse
- #describe_context(msg) ⇒ Object
-
#initialize ⇒ Reporter
constructor
A new instance of Reporter.
- #report(description, response) ⇒ Object
- #summarize(&block) ⇒ Object
Constructor Details
#initialize ⇒ Reporter
Returns a new instance of Reporter.
4 5 6 |
# File 'lib/riot/reporter.rb', line 4 def initialize @passes = @failures = @errors = 0 end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
3 4 5 |
# File 'lib/riot/reporter.rb', line 3 def errors @errors end |
#failures ⇒ Object
Returns the value of attribute failures.
3 4 5 |
# File 'lib/riot/reporter.rb', line 3 def failures @failures end |
#passes ⇒ Object
Returns the value of attribute passes.
3 4 5 |
# File 'lib/riot/reporter.rb', line 3 def passes @passes end |
Instance Method Details
#describe_context(msg) ⇒ Object
15 |
# File 'lib/riot/reporter.rb', line 15 def describe_context(msg); end |
#report(description, response) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/riot/reporter.rb', line 17 def report(description, response) code, result = *response case code when :pass then @passes += 1 pass(description) when :fail then @failures += 1 fail(description, result) when :error then @errors += 1 error(description, result) end end |
#summarize(&block) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/riot/reporter.rb', line 8 def summarize(&block) started = Time.now yield ensure results(Time.now - started) end |