Class: Backspin::Matcher
- Inherits:
-
Object
- Object
- Backspin::Matcher
- Defined in:
- lib/backspin/matcher.rb
Overview
Handles matching logic between expected and actual snapshots.
Instance Attribute Summary collapse
-
#actual ⇒ Object
readonly
Returns the value of attribute actual.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
Instance Method Summary collapse
-
#failure_reason ⇒ String
Reason why matching failed.
-
#initialize(config:, expected:, actual:) ⇒ Matcher
constructor
A new instance of Matcher.
-
#match? ⇒ Boolean
True if snapshots match according to configured matcher.
Constructor Details
#initialize(config:, expected:, actual:) ⇒ Matcher
Returns a new instance of Matcher.
8 9 10 11 12 |
# File 'lib/backspin/matcher.rb', line 8 def initialize(config:, expected:, actual:) @config = normalize_config(config) @expected = expected @actual = actual end |
Instance Attribute Details
#actual ⇒ Object (readonly)
Returns the value of attribute actual.
6 7 8 |
# File 'lib/backspin/matcher.rb', line 6 def actual @actual end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/backspin/matcher.rb', line 6 def config @config end |
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
6 7 8 |
# File 'lib/backspin/matcher.rb', line 6 def expected @expected end |
Instance Method Details
#failure_reason ⇒ String
Returns reason why matching failed.
20 21 22 |
# File 'lib/backspin/matcher.rb', line 20 def failure_reason evaluation[:reason] end |
#match? ⇒ Boolean
Returns true if snapshots match according to configured matcher.
15 16 17 |
# File 'lib/backspin/matcher.rb', line 15 def match? evaluation[:match] end |