summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-09-25 20:25:40 +0000
committerRobert Speicher <robert@gitlab.com>2017-09-25 20:25:40 +0000
commita4ffde6efe7d0218fc79e7d5b1307caa675dd358 (patch)
tree9c61eefe43370ec69b94ca44ba54d3842b72cf6a
parentecd17958cdc89df4fa7a2805ac4b50463557dcac (diff)
parent9025ce14d9c69443d8e412840c353b992048970b (diff)
downloadgitlab-ce-38362-delayed-pr-merge-wait-time-40m-1h.tar.gz
Merge branch 'rc/tag-specs' into 'master'38362-delayed-pr-merge-wait-time-40m-1h
Add a `:type` to all specs See merge request gitlab-org/gitlab-ce!14371
-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!