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
cf1da166
Commit
cf1da166
authored
Jun 17, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
6fa9f078
e398409a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
1 deletion
+81
-1
app/graphql/types/issue_type.rb
app/graphql/types/issue_type.rb
+2
-0
app/graphql/types/merge_request_type.rb
app/graphql/types/merge_request_type.rb
+2
-0
app/graphql/types/task_completion_status.rb
app/graphql/types/task_completion_status.rb
+11
-0
changelogs/unreleased/62910-task-completion-status-gql-pderichs.yml
.../unreleased/62910-task-completion-status-gql-pderichs.yml
+5
-0
spec/requests/api/graphql/tasks/task_completion_status_spec.rb
...requests/api/graphql/tasks/task_completion_status_spec.rb
+60
-0
spec/support/helpers/graphql_helpers.rb
spec/support/helpers/graphql_helpers.rb
+1
-1
No files found.
app/graphql/types/issue_type.rb
View file @
cf1da166
...
...
@@ -51,6 +51,8 @@ module Types
field
:created_at
,
Types
::
TimeType
,
null:
false
field
:updated_at
,
Types
::
TimeType
,
null:
false
field
:task_completion_status
,
Types
::
TaskCompletionStatus
,
null:
false
end
end
...
...
app/graphql/types/merge_request_type.rb
View file @
cf1da166
...
...
@@ -55,5 +55,7 @@ module Types
field
:head_pipeline
,
Types
::
Ci
::
PipelineType
,
null:
true
,
method: :actual_head_pipeline
field
:pipelines
,
Types
::
Ci
::
PipelineType
.
connection_type
,
resolver:
Resolvers
::
MergeRequestPipelinesResolver
field
:task_completion_status
,
Types
::
TaskCompletionStatus
,
null:
false
end
end
app/graphql/types/task_completion_status.rb
0 → 100644
View file @
cf1da166
# frozen_string_literal: true
module
Types
class
TaskCompletionStatus
<
BaseObject
graphql_name
'TaskCompletionStatus'
description
'Completion status of tasks'
field
:count
,
GraphQL
::
INT_TYPE
,
null:
false
field
:completed_count
,
GraphQL
::
INT_TYPE
,
null:
false
end
end
changelogs/unreleased/62910-task-completion-status-gql-pderichs.yml
0 → 100644
View file @
cf1da166
---
title
:
Make task completion status available via GraphQL
merge_request
:
author
:
type
:
added
spec/requests/api/graphql/tasks/task_completion_status_spec.rb
0 → 100644
View file @
cf1da166
# frozen_string_literal: true
require
'spec_helper'
describe
'getting task completion status information'
do
include
GraphqlHelpers
DESCRIPTION_0_DONE
=
'- [ ] task 1\n- [ ] task 2'
DESCRIPTION_1_DONE
=
'- [x] task 1\n- [ ] task 2'
DESCRIPTION_2_DONE
=
'- [x] task 1\n- [x] task 2'
set
(
:user1
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
,
:repository
,
:public
)
}
let
(
:fields
)
do
<<~
QUERY
taskCompletionStatus {
count,
completedCount
}
QUERY
end
def
create_task_completion_status_query_for
(
type
,
iid
)
graphql_query_for
(
'project'
,
{
'fullPath'
=>
project
.
full_path
},
query_graphql_field
(
type
,
{
iid:
iid
},
fields
)
)
end
shared_examples_for
'graphql task completion status provider'
do
|
type
|
it
'returns the expected task completion status'
do
post_graphql
(
create_task_completion_status_query_for
(
type
,
item
.
iid
),
current_user:
user1
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
task_completion_status
=
graphql_data
.
dig
(
'project'
,
type
,
'taskCompletionStatus'
)
expect
(
task_completion_status
).
not_to
be_nil
expect
(
task_completion_status
[
'count'
]).
to
eq
(
item
.
task_completion_status
[
:count
])
expect
(
task_completion_status
[
'completedCount'
]).
to
eq
(
item
.
task_completion_status
[
:completed_count
])
end
end
[
DESCRIPTION_0_DONE
,
DESCRIPTION_1_DONE
,
DESCRIPTION_2_DONE
].
each
do
|
desc
|
context
"with description
#{
desc
}
"
do
context
'when type is issue'
do
it_behaves_like
'graphql task completion status provider'
,
'issue'
do
let
(
:item
)
{
create
(
:issue
,
project:
project
,
description:
desc
)
}
end
end
context
'when type is merge request'
do
it_behaves_like
'graphql task completion status provider'
,
'mergeRequest'
do
let
(
:item
)
{
create
(
:merge_request
,
author:
user1
,
source_project:
project
,
description:
desc
)
}
end
end
end
end
end
spec/support/helpers/graphql_helpers.rb
View file @
cf1da166
...
...
@@ -157,7 +157,7 @@ module GraphqlHelpers
when
Array
# multiplexed queries
json_response
.
map
{
|
response
|
response
[
'errors'
]
}
else
raise
"Unkown GraphQL response type
#{
json_response
.
class
}
"
raise
"Unk
n
own GraphQL response type
#{
json_response
.
class
}
"
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