Module: Introspection::Assertions

Defined in:
lib/introspection/assertions.rb

Instance Method Summary collapse

Instance Method Details

#assert_snapshot_changed(object) ⇒ Object



3
4
5
6
7
8
# File 'lib/introspection/assertions.rb', line 3

def assert_snapshot_changed(object)
  before = Snapshot.new(object)
  yield
  after = Snapshot.new(object)
  assert before.changed?(after), "Snapshot has not changed."
end

#assert_snapshot_unchanged(object) ⇒ Object



10
11
12
13
14
15
# File 'lib/introspection/assertions.rb', line 10

def assert_snapshot_unchanged(object)
  before = Snapshot.new(object)
  yield
  after = Snapshot.new(object)
  assert !before.changed?(after), "Snapshot has changed: #{before.diff(after).inspect}"
end