class RSpec::Cheki::Snapshot

Attributes

actual[R]
expected[R]
key[R]

Public Class Methods

new(key) click to toggle source

@param [String] key The key

# File lib/rspec/cheki/snapshot.rb, line 9
def initialize key
  @key = key
  @expected_updated = false
  @actual_updated = false
end

Public Instance Methods

actual=(value) click to toggle source
# File lib/rspec/cheki/snapshot.rb, line 35
def actual= value
  @actual_updated = true
  @actual = value
end
expected=(value) click to toggle source
# File lib/rspec/cheki/snapshot.rb, line 30
def expected= value
  @expected_updated = true
  @expected = value
end
match?() click to toggle source

@return [boolean] true if the actual value is equal to stored value from snapshot

# File lib/rspec/cheki/snapshot.rb, line 16
def match?
  actual == expected
end
needs_update?() click to toggle source

@return [boolean] true if the snapshot changed

# File lib/rspec/cheki/snapshot.rb, line 26
def needs_update?
  @actual_updated && !match?
end
new?() click to toggle source

@return [boolean] true if the snapshot is stored

# File lib/rspec/cheki/snapshot.rb, line 21
def new?
  !@expected_updated
end