Class: Maze::Compare::Result
- Inherits:
-
Object
- Object
- Maze::Compare::Result
- Defined in:
- lib/maze/compare.rb
Overview
Provides a way to delivering results of element comparisons to test steps
Instance Attribute Summary collapse
-
#equal ⇒ Object
writeonly
Sets the attribute equal.
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
-
#reasons ⇒ Object
readonly
Returns the value of attribute reasons.
Instance Method Summary collapse
-
#assert_equal ⇒ Object
Provides a standard assertion of equality, with standardised output.
-
#equal? ⇒ Boolean
Indicates if the values compared to produced this result were equal.
-
#initialize ⇒ Result
constructor
Creates the Result object.
-
#keypath ⇒ String
Returns the keys traversed in order to compare the end values.
Constructor Details
#initialize ⇒ Result
Creates the Result object
21 22 23 24 25 |
# File 'lib/maze/compare.rb', line 21 def initialize @equal = true @keys = [] @reasons = [] end |
Instance Attribute Details
#equal=(value) ⇒ Object (writeonly)
Sets the attribute equal
14 15 16 |
# File 'lib/maze/compare.rb', line 14 def equal=(value) @equal = value end |
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
18 19 20 |
# File 'lib/maze/compare.rb', line 18 def keys @keys end |
#reasons ⇒ Object (readonly)
Returns the value of attribute reasons.
10 11 12 |
# File 'lib/maze/compare.rb', line 10 def reasons @reasons end |
Instance Method Details
#assert_equal ⇒ Object
Provides a standard assertion of equality, with standardised output
42 43 44 |
# File 'lib/maze/compare.rb', line 42 def assert_equal Maze.check.true(@equal, "The compared fields do not match:\n #{result.reasons.join('\n')}") end |
#equal? ⇒ Boolean
Indicates if the values compared to produced this result were equal
30 31 32 |
# File 'lib/maze/compare.rb', line 30 def equal? @equal end |
#keypath ⇒ String
Returns the keys traversed in order to compare the end values
37 38 39 |
# File 'lib/maze/compare.rb', line 37 def keypath keys.length > 0 ? keys.reverse.join('.') : '<root>' end |