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
cc3887f0
Commit
cc3887f0
authored
Mar 12, 2020
by
Jason Goodman
Committed by
Kamil Trzciński
Mar 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for existing spec
Comment implementation code and new spec
parent
6dc8e6fc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
0 deletions
+66
-0
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+66
-0
No files found.
spec/controllers/projects/pipelines_controller_spec.rb
View file @
cc3887f0
...
...
@@ -10,6 +10,7 @@ describe Projects::PipelinesController do
let
(
:feature
)
{
ProjectFeature
::
ENABLED
}
before
do
allow
(
Sidekiq
.
logger
).
to
receive
(
:info
)
stub_not_protect_default_branch
project
.
add_developer
(
user
)
project
.
project_feature
.
update
(
builds_access_level:
feature
)
...
...
@@ -583,6 +584,71 @@ describe Projects::PipelinesController do
end
end
describe
'POST create'
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
before
do
project
.
add_developer
(
user
)
project
.
project_feature
.
update
(
builds_access_level:
feature
)
end
context
'with a valid .gitlab-ci.yml file'
do
before
do
stub_ci_pipeline_yaml_file
(
YAML
.
dump
({
test:
{
stage:
'test'
,
script:
'echo'
}
}))
end
shared_examples
'creates a pipeline'
do
it
do
expect
{
post_request
}.
to
change
{
project
.
ci_pipelines
.
count
}.
by
(
1
)
pipeline
=
project
.
ci_pipelines
.
last
expected_redirect_path
=
Gitlab
::
Routing
.
url_helpers
.
project_pipeline_path
(
project
,
pipeline
)
expect
(
pipeline
).
to
be_pending
expect
(
response
).
to
redirect_to
(
expected_redirect_path
)
end
end
it_behaves_like
'creates a pipeline'
context
'when latest commit contains [ci skip]'
do
before
do
project
.
repository
.
create_file
(
user
,
'new-file.txt'
,
'A new file'
,
message:
'[skip ci] This is a test'
,
branch_name:
'master'
)
end
it_behaves_like
'creates a pipeline'
end
end
context
'with an invalid .gitlab-ci.yml file'
do
before
do
stub_ci_pipeline_yaml_file
(
'invalid yaml file'
)
end
it
'does not persist a pipeline'
do
expect
{
post_request
}.
not_to
change
{
project
.
ci_pipelines
.
count
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
def
post_request
post
:create
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
,
pipeline:
{
ref:
'master'
}
}
end
end
describe
'POST retry.json'
do
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
:failed
,
project:
project
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:failed
,
pipeline:
pipeline
)
}
...
...
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