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
39f05fd8
Commit
39f05fd8
authored
Sep 26, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for pipeline builder repository validator
parent
652ecff9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
spec/lib/gitlab/ci/pipeline/chain/validate/repository_spec.rb
.../lib/gitlab/ci/pipeline/chain/validate/repository_spec.rb
+60
-0
No files found.
spec/lib/gitlab/ci/pipeline/chain/validate/repository_spec.rb
0 → 100644
View file @
39f05fd8
require
'spec_helper'
describe
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Validate
::
Repository
do
set
(
:project
)
{
create
(
:project
,
:repository
)
}
set
(
:user
)
{
create
(
:user
)
}
let
(
:command
)
do
double
(
'command'
,
project:
project
,
current_user:
user
)
end
let!
(
:step
)
{
described_class
.
new
(
pipeline
,
command
)
}
before
do
step
.
perform!
end
context
'when pipeline ref and sha exists'
do
let
(
:pipeline
)
do
build_stubbed
(
:ci_pipeline
,
ref:
'master'
,
sha:
'123'
,
project:
project
)
end
it
'does not break the chain'
do
expect
(
step
.
break?
).
to
be
false
end
it
'does not append pipeline errors'
do
expect
(
pipeline
.
errors
).
to
be_empty
end
end
context
'when pipeline ref does not exist'
do
let
(
:pipeline
)
do
build_stubbed
(
:ci_pipeline
,
ref:
'something'
,
project:
project
)
end
it
'breaks the chain'
do
expect
(
step
.
break?
).
to
be
true
end
it
'adds an error about missing ref'
do
expect
(
pipeline
.
errors
.
to_a
)
.
to
include
'Reference not found'
end
end
context
'when pipeline does not have SHA set'
do
let
(
:pipeline
)
do
build_stubbed
(
:ci_pipeline
,
ref:
'master'
,
sha:
nil
,
project:
project
)
end
it
'breaks the chain'
do
expect
(
step
.
break?
).
to
be
true
end
it
'adds an error about missing SHA'
do
expect
(
pipeline
.
errors
.
to_a
)
.
to
include
'Commit not found'
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