Module: SnapshotTesting::TestUnit

Defined in:
lib/snapshot_testing/test_unit.rb

Instance Method Summary collapse

Instance Method Details

#assert_snapshot(actual) ⇒ Object



19
20
21
# File 'lib/snapshot_testing/test_unit.rb', line 19

def assert_snapshot(actual)
  assert_equal(@__snapshot_recorder__.record(actual), actual)
end

#setupObject



5
6
7
8
9
10
11
12
# File 'lib/snapshot_testing/test_unit.rb', line 5

def setup
  @__snapshot_recorder__ = SnapshotTesting::Recorder.new(
    name: method_name,
    path: method(method_name).source_location.first,
    update: !ENV['UPDATE_SNAPSHOTS'].nil?
  )
  super
end

#teardownObject



14
15
16
17
# File 'lib/snapshot_testing/test_unit.rb', line 14

def teardown
  super
  @__snapshot_recorder__.commit
end