Module: OhSnap::RSpec
- Includes:
- Helper
- Defined in:
- lib/oh_snap/rspec.rb
Overview
OhSnap helper for RSpec.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Helper
#save_snapshots, #setup_snapshots, #snapshot_matches
Class Method Details
.included(rspec) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/oh_snap/rspec.rb', line 10 def self.included(rspec) rspec.before do setup_snapshots(path: File.dirname(File.(rspec.location))) end rspec.after do save_snapshots end end |
Instance Method Details
#snapshot(name: nil) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/oh_snap/rspec.rb', line 20 def snapshot(name: nil) name ||= ::RSpec.current_example .full_description .tr("%$|/:;<>?*#\"\t\r\n\\", '-') .tr(' ', '_') .strip super(name: name) end |