Class: RCheck::Result
- Inherits:
-
Object
- Object
- RCheck::Result
- Defined in:
- lib/rcheck/result.rb
Overview
Suites and assertions must implement a method called .result, which returns an instance of this class. This is in order to have a fixed interface between test results and report printers. Only the relevant fields should be filled out, as the reporter will ignore empty fields.
Instance Attribute Summary collapse
-
#backtrace ⇒ Object
readonly
Returns the value of attribute backtrace.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#introspection ⇒ Object
readonly
Returns the value of attribute introspection.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#suite ⇒ Object
readonly
Returns the value of attribute suite.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(hash) ⇒ Result
Returns a new instance of Result.
16 17 18 19 20 21 22 23 24 |
# File 'lib/rcheck/result.rb', line 16 def initialize(hash) hash.each { |k, v| instance_variable_set "@#{k}", v } @info ||= [] @backtrace ||= [] @location || raise('assertion did not provide a location') unless hash[:progress] == false ProgressPrinters.track_progress! self end end |
Instance Attribute Details
#backtrace ⇒ Object (readonly)
Returns the value of attribute backtrace.
8 9 10 |
# File 'lib/rcheck/result.rb', line 8 def backtrace @backtrace end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
8 9 10 |
# File 'lib/rcheck/result.rb', line 8 def info @info end |
#introspection ⇒ Object (readonly)
Returns the value of attribute introspection.
8 9 10 |
# File 'lib/rcheck/result.rb', line 8 def introspection @introspection end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
8 9 10 |
# File 'lib/rcheck/result.rb', line 8 def location @location end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/rcheck/result.rb', line 8 def status @status end |
#suite ⇒ Object (readonly)
Returns the value of attribute suite.
8 9 10 |
# File 'lib/rcheck/result.rb', line 8 def suite @suite end |