Class: RSpec::Cheki::Matchers::MatchSnapshot
- Inherits:
-
Object
- Object
- RSpec::Cheki::Matchers::MatchSnapshot
- Extended by:
- Forwardable
- Defined in:
- lib/rspec/cheki/matchers/match_snapshot.rb
Instance Attribute Summary collapse
-
#example ⇒ Object
readonly
Returns the value of attribute example.
-
#snapshot ⇒ Object
readonly
Returns the value of attribute snapshot.
Instance Method Summary collapse
- #description ⇒ Object
- #diffable? ⇒ Boolean
- #failure_message ⇒ Object
-
#initialize ⇒ MatchSnapshot
constructor
A new instance of MatchSnapshot.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize ⇒ MatchSnapshot
Returns a new instance of MatchSnapshot.
10 11 12 13 |
# File 'lib/rspec/cheki/matchers/match_snapshot.rb', line 10 def initialize @example = RSpec.current_example @snapshot = RSpec::Cheki::Manager.create_snapshot(example: example) end |
Instance Attribute Details
#example ⇒ Object (readonly)
Returns the value of attribute example.
5 6 7 |
# File 'lib/rspec/cheki/matchers/match_snapshot.rb', line 5 def example @example end |
#snapshot ⇒ Object (readonly)
Returns the value of attribute snapshot.
5 6 7 |
# File 'lib/rspec/cheki/matchers/match_snapshot.rb', line 5 def snapshot @snapshot end |
Instance Method Details
#description ⇒ Object
19 20 21 |
# File 'lib/rspec/cheki/matchers/match_snapshot.rb', line 19 def description "match stored snapshot" end |
#diffable? ⇒ Boolean
28 29 30 |
# File 'lib/rspec/cheki/matchers/match_snapshot.rb', line 28 def diffable? true end |
#failure_message ⇒ Object
15 16 17 |
# File 'lib/rspec/cheki/matchers/match_snapshot.rb', line 15 def "received value does not match stored snapshot #{snapshot.key}" end |
#matches?(actual) ⇒ Boolean
23 24 25 26 |
# File 'lib/rspec/cheki/matchers/match_snapshot.rb', line 23 def matches?(actual) snapshot.actual = actual snapshot.match? end |