summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2017-09-26 16:24:54 -0500
committerEric Eastwood <contact@ericeastwood.com>2017-09-26 16:24:54 -0500
commit6f9a6d37a9237d19447c7936c53df02d841f5c66 (patch)
treed3a88f0781e757eb15d00ea8f2a72377ad726176 /spec/spec_helper.rb
parent59d631371ce22e702791504a544c1be61fceb676 (diff)
parent05d8e87dba4abaf9eb495bac147c4d4c5426da2e (diff)
downloadgitlab-ce-6f9a6d37a9237d19447c7936c53df02d841f5c66.tar.gz
Merge branch 'master' into ff_port_from_ee
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 92735336572..dbf05b7f004 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -64,8 +64,16 @@ RSpec.configure do |config|
config.infer_spec_type_from_file_location!
- config.define_derived_metadata(file_path: %r{/spec/requests/(ci/)?api/}) do |metadata|
- metadata[:api] = true
+ config.define_derived_metadata(file_path: %r{/spec/}) do |metadata|
+ location = metadata[:location]
+
+ metadata[:api] = true if location =~ %r{/spec/requests/api/}
+
+ # do not overwrite type if it's already set
+ next if metadata.key?(:type)
+
+ match = location.match(%r{/spec/([^/]+)/})
+ metadata[:type] = match[1].singularize.to_sym if match
end
config.raise_errors_for_deprecations!