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
a9fcbb72
Commit
a9fcbb72
authored
Feb 21, 2022
by
Mehmet Emin INAC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix response of `securityTrainingUpdate` mutation
Changelog: fixed EE: true
parent
898e870a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
ee/app/graphql/types/security/training_type.rb
ee/app/graphql/types/security/training_type.rb
+6
-0
ee/spec/graphql/types/security/training_type_spec.rb
ee/spec/graphql/types/security/training_type_spec.rb
+29
-0
No files found.
ee/app/graphql/types/security/training_type.rb
View file @
a9fcbb72
...
...
@@ -27,6 +27,12 @@ module Types
field
:is_primary
,
GraphQL
::
Types
::
Boolean
,
null:
false
,
description:
'Represents whether the provider is set as primary or not.'
def
is_primary
# rubocop:disable Naming/PredicateName
return
false
if
object
.
destroyed?
object
.
is_primary
end
end
end
end
ee/spec/graphql/types/security/training_type_spec.rb
View file @
a9fcbb72
...
...
@@ -6,4 +6,33 @@ RSpec.describe GitlabSchema.types['ProjectSecurityTraining'] do
let
(
:fields
)
{
%i[id name description url logo_url is_enabled is_primary]
}
it
{
expect
(
described_class
).
to
have_graphql_fields
(
fields
)
}
describe
'#is_primary'
do
let
(
:training
)
{
create
(
:security_training
,
:primary
)
}
let
(
:query
)
{
double
(
'query'
,
schema:
GitlabSchema
,
with_error_handling:
true
)
}
let
(
:query_context
)
{
GraphQL
::
Query
::
Context
.
new
(
query:
query
,
values:
{},
object:
nil
)
}
let
(
:type_instance
)
{
described_class
.
authorized_new
(
training
,
query_context
)
}
subject
{
type_instance
.
is_primary
}
context
'when the object is destroyed'
do
before
do
training
.
destroy!
end
it
{
is_expected
.
to
be
(
false
)
}
end
context
'when the object is not destroyed'
do
context
'when the object is not primary'
do
let
(
:training
)
{
create
(
:security_training
)
}
it
{
is_expected
.
to
be
(
false
)
}
end
context
'when the object is primary'
do
it
{
is_expected
.
to
be
(
true
)
}
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