Commit d1cbcaf1 authored by Laura Montemayor's avatar Laura Montemayor Committed by lauraMon

Cleaned up some specs and refactored

* Uses Global ID
* Updates schema
parent 25b3a293
......@@ -3,14 +3,14 @@
module Mutations
module Ci
class Base < BaseMutation
argument :id, GraphQL::ID_TYPE,
argument :id, ::Types::GlobalIDType[::Ci::Pipeline],
required: true,
description: 'The id of the pipeline to mutate'
private
def find_object(id:)
::Ci::Pipeline.find(id)
GlobalID::Locator.locate(id)
end
end
end
......
......@@ -1566,6 +1566,11 @@ type CiJobEdge {
node: CiJob
}
"""
Identifier of Ci::Pipeline
"""
scalar CiPipelineID
type CiStage {
"""
Group of jobs for the stage
......@@ -10630,7 +10635,7 @@ input PipelineDestroyInput {
"""
The id of the pipeline to mutate
"""
id: ID!
id: CiPipelineID!
}
"""
......@@ -10692,7 +10697,7 @@ input PipelineRetryInput {
"""
The id of the pipeline to mutate
"""
id: ID!
id: CiPipelineID!
}
"""
......
......@@ -4249,6 +4249,16 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "SCALAR",
"name": "CiPipelineID",
"description": "Identifier of Ci::Pipeline",
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "CiStage",
......@@ -31883,7 +31893,7 @@
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"name": "CiPipelineID",
"ofType": null
}
},
......@@ -32083,7 +32093,7 @@
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"name": "CiPipelineID",
"ofType": null
}
},
......@@ -9,13 +9,7 @@ RSpec.describe 'PipelineCancel' do
let_it_be(:project) { create(:project) }
let_it_be(:pipeline) { create(:ci_pipeline, :running, project: project, user: user) }
let(:mutation) do
graphql_mutation(:pipeline_cancel, {},
<<-QL
errors
QL
)
end
let(:mutation) { graphql_mutation(:pipeline_cancel, {}, 'errors') }
let(:mutation_response) { graphql_mutation_response(:pipeline_cancel) }
......
......@@ -11,13 +11,9 @@ RSpec.describe 'PipelineDestroy' do
let(:mutation) do
variables = {
id: pipeline.id
id: pipeline.to_global_id.to_s
}
graphql_mutation(:pipeline_destroy, variables,
<<-QL
errors
QL
)
graphql_mutation(:pipeline_destroy, variables, 'errors')
end
it 'returns an error if the user is not allowed to destroy the pipeline' do
......
......@@ -11,7 +11,7 @@ RSpec.describe 'PipelineRetry' do
let(:mutation) do
variables = {
id: pipeline.id
id: pipeline.to_global_id.to_s
}
graphql_mutation(:pipeline_retry, variables,
<<-QL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment