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
0fdae852
Commit
0fdae852
authored
Jul 07, 2020
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow passing per_page to Jira ListService
parent
7f26c781
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
app/services/jira/requests/issues/list_service.rb
app/services/jira/requests/issues/list_service.rb
+4
-3
spec/services/jira/requests/issues/list_service_spec.rb
spec/services/jira/requests/issues/list_service_spec.rb
+12
-2
No files found.
app/services/jira/requests/issues/list_service.rb
View file @
0fdae852
...
...
@@ -13,15 +13,16 @@ module Jira
@jql
=
params
[
:jql
].
to_s
@page
=
params
[
:page
].
to_i
||
1
@per_page
=
params
[
:per_page
].
to_i
||
PER_PAGE
end
private
attr_reader
:jql
,
:page
attr_reader
:jql
,
:page
,
:per_page
override
:url
def
url
"
#{
base_api_url
}
/search?jql=
#{
CGI
.
escape
(
jql
)
}
&startAt=
#{
start_at
}
&maxResults=
#{
PER_PAGE
}
&fields=*all"
"
#{
base_api_url
}
/search?jql=
#{
CGI
.
escape
(
jql
)
}
&startAt=
#{
start_at
}
&maxResults=
#{
per_page
}
&fields=*all"
end
override
:build_service_response
...
...
@@ -48,7 +49,7 @@ module Jira
end
def
start_at
(
page
-
1
)
*
PER_PAGE
(
page
-
1
)
*
per_page
end
end
end
...
...
spec/services/jira/requests/issues/list_service_spec.rb
View file @
0fdae852
...
...
@@ -55,7 +55,7 @@ RSpec.describe Jira::Requests::Issues::ListService do
expect
(
client
).
to
receive
(
:get
).
and_return
([])
end
it
'returns a paylod with no issues'
do
it
'returns a paylo
a
d with no issues'
do
payload
=
subject
.
payload
expect
(
subject
.
success?
).
to
be_truthy
...
...
@@ -75,7 +75,7 @@ RSpec.describe Jira::Requests::Issues::ListService do
)
end
it
'returns a paylod with jira issues'
do
it
'returns a paylo
a
d with jira issues'
do
payload
=
subject
.
payload
expect
(
subject
.
success?
).
to
be_truthy
...
...
@@ -83,6 +83,16 @@ RSpec.describe Jira::Requests::Issues::ListService do
expect
(
payload
[
:is_last
]).
to
be_falsy
end
end
context
'when using pagination parameters'
do
let
(
:params
)
{
{
page:
3
,
per_page:
20
}
}
it
'honors page and per_page'
do
expect
(
client
).
to
receive
(
:get
).
with
(
include
(
'startAt=40&maxResults=20'
)).
and_return
([])
subject
end
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