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
72a8a9e0
Commit
72a8a9e0
authored
Aug 31, 2020
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds spec for destroyable field
parent
2dfa26d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
spec/requests/api/graphql/ci/pipeline_spec.rb
spec/requests/api/graphql/ci/pipeline_spec.rb
+50
-0
No files found.
spec/requests/api/graphql/ci/pipeline_spec.rb
0 → 100644
View file @
72a8a9e0
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'destroyable'
do
include
GraphqlHelpers
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project_owner
)
{
project
.
owner
}
let_it_be
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:query
)
do
%(
query {
project(fullPath: "#{project.full_path}") {
pipeline(iid: "#{pipeline.iid}") {
destroyable
}
}
}
)
end
let
(
:pipeline_graphql_data
)
{
graphql_data
.
dig
(
'project'
,
'pipeline'
,
'destroyable'
)
}
context
'when user does not have the permission'
do
before
do
project
.
add_developer
(
user
)
post_graphql
(
query
,
current_user:
user
)
end
it
'returns false'
do
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:destroy_pipline
,
pipeline
).
and_return
(
false
)
expect
(
pipeline_graphql_data
).
to
be
(
false
)
end
end
context
'when user is owner and therefore has the permission'
do
before
do
post_graphql
(
query
,
current_user:
project_owner
)
end
it
'returns true'
do
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
project_owner
,
:destroy_pipline
,
pipeline
).
and_return
(
true
)
expect
(
pipeline_graphql_data
).
to
be
(
true
)
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