Module: OhSnap::Helper
Overview
Helper methods for OhSnap to be included in test suites.
Instance Method Summary collapse
- #save_snapshots ⇒ Object
- #setup_snapshots(path:, serializer: OhSnap.config.serializer.new, snapshots_dirname: OhSnap.config.snapshots_dirname, writable: OhSnap.config.writable?) ⇒ Object
- #snapshot(name:) ⇒ Object
- #snapshot_matches(actual, name:) ⇒ Object
Instance Method Details
#save_snapshots ⇒ Object
27 28 29 |
# File 'lib/oh_snap/helper.rb', line 27 def save_snapshots @ohsnapshots&.save end |
#setup_snapshots(path:, serializer: OhSnap.config.serializer.new, snapshots_dirname: OhSnap.config.snapshots_dirname, writable: OhSnap.config.writable?) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/oh_snap/helper.rb', line 9 def setup_snapshots(path:, serializer: OhSnap.config.serializer.new, snapshots_dirname: OhSnap.config.snapshots_dirname, writable: OhSnap.config.writable?) @ohsnapshots = Registry.new(path: path, serializer: serializer, snapshots_dirname: snapshots_dirname, writable: writable) end |
#snapshot(name:) ⇒ Object
19 20 21 |
# File 'lib/oh_snap/helper.rb', line 19 def snapshot(name:) @ohsnapshots.snapshot(name: name) end |
#snapshot_matches(actual, name:) ⇒ Object
23 24 25 |
# File 'lib/oh_snap/helper.rb', line 23 def snapshot_matches(actual, name:) snapshot(name: name) == actual end |