Method: Sentry::TestHelper#teardown_sentry_test

Defined in:
lib/sentry/test_helper.rb

#teardown_sentry_testvoid

This method returns an undefined value.

Clears all stored events and envelopes. It should be called after every test case.

[View source]

46
47
48
49
50
51
52
53
54
55
56
# File 'lib/sentry/test_helper.rb', line 46

def teardown_sentry_test
  return unless Sentry.initialized?

  # pop testing layer created by `setup_sentry_test`
  # but keep the base layer to avoid nil-pointer errors
  # TODO: find a way to notify users if they somehow popped the test layer before calling this method
  if Sentry.get_current_hub.instance_variable_get(:@stack).size > 1
    Sentry.get_current_hub.pop_scope
  end
  Sentry::Scope.global_event_processors.clear
end