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
ceafd6c9
Commit
ceafd6c9
authored
Oct 26, 2020
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lm-fix-icon' into 'master'
Fixes bug with action_icon See merge request gitlab-org/gitlab!45302
parents
fca02890
84737d91
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 @
ceafd6c9
...
@@ -30,7 +30,7 @@ module Types
...
@@ -30,7 +30,7 @@ module Types
if
obj
.
has_action?
if
obj
.
has_action?
{
{
button_title:
obj
.
action_button_title
,
button_title:
obj
.
action_button_title
,
icon:
obj
.
icon
,
icon:
obj
.
action_
icon
,
method:
obj
.
action_method
,
method:
obj
.
action_method
,
path:
obj
.
action_path
,
path:
obj
.
action_path
,
title:
obj
.
action_title
title:
obj
.
action_title
...
...
spec/graphql/types/ci/detailed_status_type_spec.rb
View file @
ceafd6c9
...
@@ -3,11 +3,30 @@
...
@@ -3,11 +3,30 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
Types
::
Ci
::
DetailedStatusType
do
RSpec
.
describe
Types
::
Ci
::
DetailedStatusType
do
include
GraphqlHelpers
specify
{
expect
(
described_class
.
graphql_name
).
to
eq
(
'DetailedStatus'
)
}
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
,
expect
(
described_class
).
to
have_graphql_fields
(
:group
,
:icon
,
:favicon
,
:details_path
,
:has_details
,
:details_path
,
:has_details
,
:label
,
:text
,
:tooltip
,
:action
)
:label
,
:text
,
:tooltip
,
:action
)
end
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
end
spec/support/helpers/graphql_helpers.rb
View file @
ceafd6c9
...
@@ -112,6 +112,16 @@ module GraphqlHelpers
...
@@ -112,6 +112,16 @@ module GraphqlHelpers
end
end
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
# Recursively convert a Hash with Ruby-style keys to GraphQL fieldname-style keys
#
#
# prepare_input_for_mutation({ 'my_key' => 1 })
# 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