Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
9025ce14
Commit
9025ce14
authored
Sep 19, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically set a :type for specs
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
d103e955
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
spec/spec_helper.rb
spec/spec_helper.rb
+10
-2
No files found.
spec/spec_helper.rb
View file @
9025ce14
...
@@ -64,8 +64,16 @@ RSpec.configure do |config|
...
@@ -64,8 +64,16 @@ RSpec.configure do |config|
config
.
infer_spec_type_from_file_location!
config
.
infer_spec_type_from_file_location!
config
.
define_derived_metadata
(
file_path:
%r{/spec/requests/(ci/)?api/}
)
do
|
metadata
|
config
.
define_derived_metadata
(
file_path:
%r{/spec/}
)
do
|
metadata
|
metadata
[
:api
]
=
true
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
end
config
.
raise_errors_for_deprecations!
config
.
raise_errors_for_deprecations!
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment