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
f867d80c
Commit
f867d80c
authored
Jul 08, 2020
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add additional sort values for jira issue finder
that will get supplied by the frontend
parent
663a98f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
16 deletions
+40
-16
app/finders/projects/integrations/jira/issues_finder.rb
app/finders/projects/integrations/jira/issues_finder.rb
+7
-1
spec/finders/projects/integrations/jira/issues_finder_spec.rb
.../finders/projects/integrations/jira/issues_finder_spec.rb
+33
-15
No files found.
app/finders/projects/integrations/jira/issues_finder.rb
View file @
f867d80c
...
...
@@ -48,8 +48,14 @@ module Projects
def
map_sort_values
(
sort
)
case
sort
when
'created_date'
when
'created_date'
,
'created_desc'
{
sort:
'created'
,
sort_direction:
'DESC'
}
when
'created_asc'
{
sort:
'created'
,
sort_direction:
'ASC'
}
when
'updated_desc'
{
sort:
'updated'
,
sort_direction:
'DESC'
}
when
'updated_asc'
{
sort:
'updated'
,
sort_direction:
'ASC'
}
else
{
sort:
::
Jira
::
JqlBuilderService
::
DEFAULT_SORT
,
sort_direction:
::
Jira
::
JqlBuilderService
::
DEFAULT_SORT_DIRECTION
}
end
...
...
spec/finders/projects/integrations/jira/issues_finder_spec.rb
View file @
f867d80c
...
...
@@ -76,27 +76,45 @@ RSpec.describe Projects::Integrations::Jira::IssuesFinder do
expect
(
issues
.
map
(
&
:key
)).
to
eq
(
%w[TEST-1 TEST-2]
)
end
context
'when sort by created_date'
do
let
(
:params
)
{
{
sort:
'created_date'
}
}
context
'when sorting'
do
shared_examples
'maps sort values'
do
it
do
expect
(
::
Jira
::
JqlBuilderService
).
to
receive
(
:new
)
.
with
(
jira_service
.
project_key
,
expected_sort_values
)
.
and_call_original
subject
end
end
it
'maps sort correctly
'
do
expect
(
::
Jira
::
JqlBuilderService
).
to
receive
(
:new
)
.
with
(
jira_service
.
project_key
,
{
sort:
'created'
,
sort_direction:
'DESC'
})
.
and_call_original
it
_behaves_like
'maps sort values
'
do
let
(
:params
)
{
{
sort:
'created_date'
}
}
let
(
:expected_sort_values
)
{
{
sort:
'created'
,
sort_direction:
'DESC'
}
}
end
subject
it_behaves_like
'maps sort values'
do
let
(
:params
)
{
{
sort:
'created_desc'
}
}
let
(
:expected_sort_values
)
{
{
sort:
'created'
,
sort_direction:
'DESC'
}
}
end
end
context
'when sort by unknown_sort'
do
let
(
:params
)
{
{
sort:
'unknown_sort'
}
}
it_behaves_like
'maps sort values'
do
let
(
:params
)
{
{
sort:
'created_asc'
}
}
let
(
:expected_sort_values
)
{
{
sort:
'created'
,
sort_direction:
'ASC'
}
}
end
it
'maps sort to default'
do
expect
(
::
Jira
::
JqlBuilderService
).
to
receive
(
:new
)
.
with
(
jira_service
.
project_key
,
{
sort:
'created'
,
sort_direction:
'DESC'
})
.
and_call_original
it_behaves_like
'maps sort values'
do
let
(
:params
)
{
{
sort:
'updated_desc'
}
}
let
(
:expected_sort_values
)
{
{
sort:
'updated'
,
sort_direction:
'DESC'
}
}
end
it_behaves_like
'maps sort values'
do
let
(
:params
)
{
{
sort:
'updated_asc'
}
}
let
(
:expected_sort_values
)
{
{
sort:
'updated'
,
sort_direction:
'ASC'
}
}
end
subject
it_behaves_like
'maps sort values'
do
let
(
:params
)
{
{
sort:
'unknown_sort'
}
}
let
(
:expected_sort_values
)
{
{
sort:
'created'
,
sort_direction:
'DESC'
}
}
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