Module: Rspec::SideEffects
- Defined in:
- lib/rspec/side_effects.rb,
lib/rspec/side_effects/version.rb
Overview
This module will allow the side effects of RSpec examples to be written more clearly and consistently.
Constant Summary collapse
- VERSION =
'0.3.0'
Instance Method Summary collapse
- #its_side_effects_are(*options, &block) ⇒ Object (also: #it_has_side_effects, #specify_side_effects)
Instance Method Details
#its_side_effects_are(*options, &block) ⇒ Object Also known as: it_has_side_effects, specify_side_effects
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rspec/side_effects.rb', line 11 def its_side_effects_are(*, &block) its_caller = caller.grep_v(/its_side_effects/) if .last.is_a?(Hash) .last.merge(called: its_caller) else .push(called: its_caller) end describe('side effects', *) do if block # rubocop:disable Lint/RescueException, Lint/SuppressedException before do subject rescue Exception end # rubocop:enable Lint/RescueException, Lint/SuppressedException example(nil, :aggregate_failures, *, &block) else example(nil, {}) { subject } end end end |