Skip to content
Snippets Groups Projects
Commit 9025ce14 authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Automatically set a :type for specs


Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent d103e955
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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!
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment