BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
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