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
7fb3a78a
Commit
7fb3a78a
authored
Mar 17, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix improper method name and spec description
parent
c79c3895
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
app/finders/pipelines_finder.rb
app/finders/pipelines_finder.rb
+2
-2
spec/finders/pipelines_finder_spec.rb
spec/finders/pipelines_finder_spec.rb
+3
-3
No files found.
app/finders/pipelines_finder.rb
View file @
7fb3a78a
...
@@ -15,7 +15,7 @@ class PipelinesFinder
...
@@ -15,7 +15,7 @@ class PipelinesFinder
items
=
by_name
(
items
)
items
=
by_name
(
items
)
items
=
by_username
(
items
)
items
=
by_username
(
items
)
items
=
by_yaml_errors
(
items
)
items
=
by_yaml_errors
(
items
)
order_and_sort
(
items
)
sort_items
(
items
)
end
end
private
private
...
@@ -107,7 +107,7 @@ class PipelinesFinder
...
@@ -107,7 +107,7 @@ class PipelinesFinder
end
end
end
end
def
order_and_sort
(
items
)
def
sort_items
(
items
)
order_by
=
if
%w[id status ref user_id]
.
include?
(
params
[
:order_by
])
# Allow only indexed columns
order_by
=
if
%w[id status ref user_id]
.
include?
(
params
[
:order_by
])
# Allow only indexed columns
params
[
:order_by
]
params
[
:order_by
]
else
else
...
...
spec/finders/pipelines_finder_spec.rb
View file @
7fb3a78a
...
@@ -208,7 +208,7 @@ describe PipelinesFinder do
...
@@ -208,7 +208,7 @@ describe PipelinesFinder do
context
'when order_by and sort are valid'
do
context
'when order_by and sort are valid'
do
let
(
:params
)
{
{
order_by:
'user_id'
,
sort:
'asc'
}
}
let
(
:params
)
{
{
order_by:
'user_id'
,
sort:
'asc'
}
}
it
'sorts pipelines
by default
'
do
it
'sorts pipelines'
do
expect
(
subject
).
to
eq
(
Ci
::
Pipeline
.
order
(
user_id: :asc
))
expect
(
subject
).
to
eq
(
Ci
::
Pipeline
.
order
(
user_id: :asc
))
end
end
end
end
...
@@ -216,7 +216,7 @@ describe PipelinesFinder do
...
@@ -216,7 +216,7 @@ describe PipelinesFinder do
context
'when order_by is invalid'
do
context
'when order_by is invalid'
do
let
(
:params
)
{
{
order_by:
'invalid_column'
,
sort:
'asc'
}
}
let
(
:params
)
{
{
order_by:
'invalid_column'
,
sort:
'asc'
}
}
it
'sorts pipelines with
default order_by (id:
)'
do
it
'sorts pipelines with
id: (default
)'
do
expect
(
subject
).
to
eq
(
Ci
::
Pipeline
.
order
(
id: :asc
))
expect
(
subject
).
to
eq
(
Ci
::
Pipeline
.
order
(
id: :asc
))
end
end
end
end
...
@@ -224,7 +224,7 @@ describe PipelinesFinder do
...
@@ -224,7 +224,7 @@ describe PipelinesFinder do
context
'when sort is invalid'
do
context
'when sort is invalid'
do
let
(
:params
)
{
{
order_by:
'user_id'
,
sort:
'invalid_sort'
}
}
let
(
:params
)
{
{
order_by:
'user_id'
,
sort:
'invalid_sort'
}
}
it
'sorts pipelines with
default sort (:desc
)'
do
it
'sorts pipelines with
:desc (default
)'
do
expect
(
subject
).
to
eq
(
Ci
::
Pipeline
.
order
(
user_id: :desc
))
expect
(
subject
).
to
eq
(
Ci
::
Pipeline
.
order
(
user_id: :desc
))
end
end
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