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
510d03fe
Commit
510d03fe
authored
Jul 22, 2019
by
Peter Leitzen
Committed by
Dan Davison
Jul 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QA: Prefer `flat_map` over `map` + `flatten`
parent
5595c9de
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
9 deletions
+7
-9
qa/qa/page/base.rb
qa/qa/page/base.rb
+2
-2
qa/qa/page/validator.rb
qa/qa/page/validator.rb
+2
-4
qa/qa/scenario/test/sanity/selectors.rb
qa/qa/scenario/test/sanity/selectors.rb
+1
-1
qa/spec/specs/runner_spec.rb
qa/spec/specs/runner_spec.rb
+2
-2
No files found.
qa/qa/page/base.rb
View file @
510d03fe
...
...
@@ -181,11 +181,11 @@ module QA
return
[
"Page class does not have views / elements defined!"
]
end
views
.
map
(
&
:errors
).
flatten
views
.
flat_map
(
&
:errors
)
end
def
self
.
elements
views
.
map
(
&
:elements
).
flatten
views
.
flat_map
(
&
:elements
)
end
def
send_keys_to_element
(
name
,
keys
)
...
...
qa/qa/page/validator.rb
View file @
510d03fe
...
...
@@ -22,16 +22,14 @@ module QA
end
def
descendants
@descendants
||=
constants
.
map
do
|
const
|
@descendants
||=
constants
.
flat_
map
do
|
const
|
case
const
when
Class
const
if
const
<
Page
::
Base
when
Module
Page
::
Validator
.
new
(
const
).
descendants
end
end
@descendants
.
flatten
.
compact
end
.
compact
end
def
errors
...
...
qa/qa/scenario/test/sanity/selectors.rb
View file @
510d03fe
...
...
@@ -14,7 +14,7 @@ module QA
Page
::
Validator
.
new
(
pages
)
end
validators
.
map
(
&
:errors
).
flatten
.
tap
do
|
errors
|
validators
.
flat_map
(
&
:errors
)
.
tap
do
|
errors
|
break
if
errors
.
none?
warn
<<~
EOS
...
...
qa/spec/specs/runner_spec.rb
View file @
510d03fe
...
...
@@ -125,9 +125,9 @@ describe QA::Specs::Runner do
end
def
excluded_feature_tags_except
(
tag
)
QA
::
Runtime
::
Env
.
supported_features
.
except
(
tag
).
map
do
|
tag
,
_
|
QA
::
Runtime
::
Env
.
supported_features
.
except
(
tag
).
flat_
map
do
|
tag
,
_
|
[
'--tag'
,
"~requires_
#{
tag
}
"
]
end
.
flatten
end
end
def
expect_rspec_runner_arguments
(
arguments
)
...
...
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