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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
da15b388
Commit
da15b388
authored
Sep 26, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for pipeline builder abilities validator
parent
fa3fb23f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
13 deletions
+29
-13
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+0
-3
spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb
spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb
+29
-10
No files found.
app/services/ci/create_pipeline_service.rb
View file @
da15b388
...
@@ -46,9 +46,6 @@ module Ci
...
@@ -46,9 +46,6 @@ module Ci
private
private
def
process_pipeline_sequence
end
def
commit
def
commit
@commit
||=
project
.
commit
(
origin_sha
||
origin_ref
)
@commit
||=
project
.
commit
(
origin_sha
||
origin_ref
)
end
end
...
...
spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb
View file @
da15b388
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Validate
::
Abilities
do
describe
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Validate
::
Abilities
do
describe
'#allowed_to_create?'
do
set
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
set
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:ref
)
{
'master'
}
let
(
:pipeline
)
do
build_stubbed
(
:ci_pipeline
,
ref:
ref
,
project:
project
)
end
let
(
:command
)
do
double
(
'command'
,
project:
project
,
current_user:
user
)
end
let
(
:step
)
{
described_class
.
new
(
pipeline
,
command
)
}
let
(
:pipeline
)
do
let
(
:ref
)
{
'master'
}
build_stubbed
(
:ci_pipeline
,
ref:
ref
,
project:
project
)
context
'when users has no ability to run a pipeline'
do
before
do
step
.
perform!
end
end
let
(
:command
)
do
it
'adds an error about insufficient permissions'
do
double
(
'command'
,
project:
project
,
current_user:
user
)
expect
(
pipeline
.
errors
.
to_a
)
.
to
include
/Insufficient permissions/
end
end
subject
do
it
'breaks the pipeline builder chain'
do
described_class
.
new
(
pipeline
,
command
).
allowed_to_create?
expect
(
step
.
break?
).
to
eq
true
end
end
end
context
'when user has ability to create a pipeline'
do
end
describe
'#allowed_to_create?'
do
subject
{
step
.
allowed_to_create?
}
context
'when user is a developer'
do
context
'when user is a developer'
do
before
do
before
do
...
...
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