Class: RSpec::Cheki::Snapshot
- Inherits:
-
Object
- Object
- RSpec::Cheki::Snapshot
- Defined in:
- lib/rspec/cheki/snapshot.rb
Instance Attribute Summary collapse
-
#actual ⇒ Object
Returns the value of attribute actual.
-
#expected ⇒ Object
Returns the value of attribute expected.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#initialize(key) ⇒ Snapshot
constructor
A new instance of Snapshot.
-
#match? ⇒ boolean
True if the actual value is equal to stored value from snapshot.
-
#needs_update? ⇒ boolean
True if the snapshot changed.
-
#new? ⇒ boolean
True if the snapshot is stored.
Constructor Details
#initialize(key) ⇒ Snapshot
Returns a new instance of Snapshot.
9 10 11 12 13 |
# File 'lib/rspec/cheki/snapshot.rb', line 9 def initialize key @key = key @expected_updated = false @actual_updated = false end |
Instance Attribute Details
#actual ⇒ Object
Returns the value of attribute actual.
6 7 8 |
# File 'lib/rspec/cheki/snapshot.rb', line 6 def actual @actual end |
#expected ⇒ Object
Returns the value of attribute expected.
6 7 8 |
# File 'lib/rspec/cheki/snapshot.rb', line 6 def expected @expected end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/rspec/cheki/snapshot.rb', line 6 def key @key end |
Instance Method Details
#match? ⇒ boolean
Returns true if the actual value is equal to stored value from snapshot.
16 17 18 |
# File 'lib/rspec/cheki/snapshot.rb', line 16 def match? actual == expected end |
#needs_update? ⇒ boolean
Returns true if the snapshot changed.
26 27 28 |
# File 'lib/rspec/cheki/snapshot.rb', line 26 def needs_update? @actual_updated && !match? end |
#new? ⇒ boolean
Returns true if the snapshot is stored.
21 22 23 |
# File 'lib/rspec/cheki/snapshot.rb', line 21 def new? !@expected_updated end |