Module: Bullematic::Integrations::RSpec
- Defined in:
- lib/bullematic/integrations/rspec.rb,
sig/generated/bullematic/integrations/rspec.rbs
Class Method Summary collapse
-
.setup ⇒ void
: () -> void.
Class Method Details
.setup ⇒ void
This method returns an undefined value.
: () -> void
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bullematic/integrations/rspec.rb', line 9 def setup ::RSpec.configure do |config| config.before(:suite) do Bullematic::Fixer.clear end config.before(:each) do |example| example.[:bullematic_request_started] = false if Bullematic.enabled? if defined?(Bullet) && Bullet.enable? Bullet.start_request example.[:bullematic_request_started] = true end end end config.after(:each) do |example| if example..delete(:bullematic_request_started) begin if Bullematic.enabled? && Bullet.enable? Bullematic::Notifier.process_notifications(context_id: example.id) end ensure Bullet.end_request end end end config.after(:suite) do Bullematic::Fixer.apply_fixes if Bullematic.configuration&.enabled && Bullematic.configuration&.auto_fix end end end |