diff options
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b15d91b41e4..5f1513b1247 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -333,10 +333,20 @@ RSpec.configure do |config| RequestStore.clear! end - config.around do |example| - # Wrap each example in it's own context to make sure the contexts don't - # leak - Labkit::Context.with_context { example.run } + if ENV['SKIP_RSPEC_CONTEXT_WRAPPING'] + config.around(:example, :context_aware) do |example| + # Wrap each example in it's own context to make sure the contexts don't + # leak + Gitlab::ApplicationContext.with_raw_context { example.run } + end + else + config.around do |example| + if [:controller, :request, :feature].include?(example.metadata[:type]) || example.metadata[:context_aware] + Gitlab::ApplicationContext.with_raw_context { example.run } + else + example.run + end + end end config.around do |example| |