Module: SnapshotTesting::Minitest
- Defined in:
- lib/snapshot_testing/minitest.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(_) ⇒ Object
5 6 7 8 9 |
# File 'lib/snapshot_testing/minitest.rb', line 5 def self.included(_) return unless defined?(::Minitest::Expectations) return if ::Minitest::Expectations.method_defined?(:must_match_snapshot) ::Minitest::Expectations.infect_an_assertion(:assert_snapshot, :must_match_snapshot, true) end |
Instance Method Details
#after_teardown ⇒ Object
20 21 22 23 |
# File 'lib/snapshot_testing/minitest.rb', line 20 def after_teardown super @__snapshot_recorder__.commit end |
#assert_snapshot(actual) ⇒ Object
25 26 27 |
# File 'lib/snapshot_testing/minitest.rb', line 25 def assert_snapshot(actual) assert_equal(@__snapshot_recorder__.record(actual), actual) end |
#before_setup ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/snapshot_testing/minitest.rb', line 11 def before_setup @__snapshot_recorder__ = SnapshotTesting::Recorder.new( name: name, path: method(name).source_location.first, update: !ENV['UPDATE_SNAPSHOTS'].nil? ) super end |