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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d0e448cf
Commit
d0e448cf
authored
Jul 01, 2020
by
Albert Salim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect view spec for haml
parent
fdc866a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
spec/tooling/lib/tooling/test_file_finder_spec.rb
spec/tooling/lib/tooling/test_file_finder_spec.rb
+16
-0
tooling/lib/tooling/test_file_finder.rb
tooling/lib/tooling/test_file_finder.rb
+5
-4
No files found.
spec/tooling/lib/tooling/test_file_finder_spec.rb
View file @
d0e448cf
...
...
@@ -120,6 +120,22 @@ RSpec.describe Tooling::TestFileFinder do
end
end
context
'when given a haml view'
do
let
(
:file
)
{
'app/views/admin/users/_user.html.haml'
}
it
'returns the matching view spec'
do
expect
(
subject
.
test_files
).
to
contain_exactly
(
'spec/views/admin/users/_user.html.haml_spec.rb'
)
end
end
context
'when given a haml view in ee/'
do
let
(
:file
)
{
'ee/app/views/admin/users/_user.html.haml'
}
it
'returns the matching view spec'
do
expect
(
subject
.
test_files
).
to
contain_exactly
(
'ee/spec/views/admin/users/_user.html.haml_spec.rb'
)
end
end
context
'when given a migration file'
do
let
(
:file
)
{
'db/migrate/20191023152913_add_default_and_free_plans.rb'
}
...
...
tooling/lib/tooling/test_file_finder.rb
View file @
d0e448cf
...
...
@@ -72,9 +72,9 @@ module Tooling
ImpactedTestFile
.
new
do
|
impact
|
impact
.
associate
(
%r{app/(.+)
\.
rb$}
)
{
|
match
|
"spec/
#{
match
[
1
]
}
_spec.rb"
}
impact
.
associate
(
%r{(tooling/)?lib/(.+)
\.
rb$}
)
{
|
match
|
"spec/
#{
match
[
1
]
}
lib/
#{
match
[
2
]
}
_spec.rb"
}
impact
.
associate
(
%r{config/initializers/(.+).rb$}
)
{
|
match
|
"spec/initializers/
#{
match
[
1
]
}
_spec.rb"
}
impact
.
associate
(
%r{config/initializers/(.+)
\
.
rb$}
)
{
|
match
|
"spec/initializers/
#{
match
[
1
]
}
_spec.rb"
}
impact
.
associate
(
'db/structure.sql'
)
{
'spec/db/schema_spec.rb'
}
impact
.
associate
(
%r{db/(?:post_)?migrate/([0-9]+)_(.+).rb$}
)
do
|
match
|
impact
.
associate
(
%r{db/(?:post_)?migrate/([0-9]+)_(.+)
\
.
rb$}
)
do
|
match
|
[
"spec/migrations/
#{
match
[
2
]
}
_spec.rb"
,
"spec/migrations/
#{
match
[
1
]
}
_
#{
match
[
2
]
}
_spec.rb"
...
...
@@ -84,8 +84,9 @@ module Tooling
end
def
either_impact
ImpactedTestFile
.
new
(
prefix:
%r{^(
#{
EE_PREFIX
}
)?}
)
do
|
impact
|
impact
.
associate
(
%r{spec/(.+)_spec.rb$}
)
{
|
match
|
match
[
0
]
}
ImpactedTestFile
.
new
(
prefix:
%r{^(?<prefix>
#{
EE_PREFIX
}
)?}
)
do
|
impact
|
impact
.
associate
(
%r{app/views/(?<view>.+)
\.
haml$}
)
{
|
match
|
"
#{
match
[
:prefix
]
}
spec/views/
#{
match
[
:view
]
}
.haml_spec.rb"
}
impact
.
associate
(
%r{spec/(.+)_spec
\.
rb$}
)
{
|
match
|
match
[
0
]
}
impact
.
associate
(
%r{spec/factories/.+
\.
rb$}
)
{
'spec/factories_spec.rb'
}
end
end
...
...
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