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
84737d91
Commit
84737d91
authored
Oct 15, 2020
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes bug with action_icon
* Adds more comprehensive spec * Adds resolve_field helper
parent
3dcc22a2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
app/graphql/types/ci/detailed_status_type.rb
app/graphql/types/ci/detailed_status_type.rb
+1
-1
spec/graphql/types/ci/detailed_status_type_spec.rb
spec/graphql/types/ci/detailed_status_type_spec.rb
+20
-1
spec/support/helpers/graphql_helpers.rb
spec/support/helpers/graphql_helpers.rb
+10
-0
No files found.
app/graphql/types/ci/detailed_status_type.rb
View file @
84737d91
...
...
@@ -30,7 +30,7 @@ module Types
if
obj
.
has_action?
{
button_title:
obj
.
action_button_title
,
icon:
obj
.
icon
,
icon:
obj
.
action_
icon
,
method:
obj
.
action_method
,
path:
obj
.
action_path
,
title:
obj
.
action_title
...
...
spec/graphql/types/ci/detailed_status_type_spec.rb
View file @
84737d91
...
...
@@ -3,11 +3,30 @@
require
'spec_helper'
RSpec
.
describe
Types
::
Ci
::
DetailedStatusType
do
include
GraphqlHelpers
specify
{
expect
(
described_class
.
graphql_name
).
to
eq
(
'DetailedStatus'
)
}
it
"has all fields"
do
it
'has all fields'
do
expect
(
described_class
).
to
have_graphql_fields
(
:group
,
:icon
,
:favicon
,
:details_path
,
:has_details
,
:label
,
:text
,
:tooltip
,
:action
)
end
describe
'action field'
do
it
'correctly renders the field'
do
stage
=
create
(
:ci_stage_entity
,
status: :skipped
)
status
=
stage
.
detailed_status
(
stage
.
pipeline
.
user
)
expected_status
=
{
button_title:
status
.
action_button_title
,
icon:
status
.
action_icon
,
method:
status
.
action_method
,
path:
status
.
action_path
,
title:
status
.
action_title
}
expect
(
resolve_field
(
'action'
,
status
)).
to
eq
(
expected_status
)
end
end
end
spec/support/helpers/graphql_helpers.rb
View file @
84737d91
...
...
@@ -112,6 +112,16 @@ module GraphqlHelpers
end
end
def
resolve_field
(
name
,
object
,
args
=
{})
context
=
double
(
"Context"
,
schema:
GitlabSchema
,
query:
GraphQL
::
Query
.
new
(
GitlabSchema
),
parent:
nil
)
field
=
described_class
.
fields
[
name
]
instance
=
described_class
.
authorized_new
(
object
,
context
)
field
.
resolve_field
(
instance
,
{},
context
)
end
# Recursively convert a Hash with Ruby-style keys to GraphQL fieldname-style keys
#
# prepare_input_for_mutation({ 'my_key' => 1 })
...
...
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