diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-17 00:11:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-17 00:11:53 +0300 |
commit | 7ea46a9866101f15734b557d812bb52d347f63fb (patch) | |
tree | c752e2f04dab642e8b3d8d026dd530a7d4c1f229 /spec/spec_helper.rb | |
parent | 889bf7a0eea1f4ac7c2ec28cdfded399c0ca8fb9 (diff) |
Add latest changes from gitlab-org/gitlab@master
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| |