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
Jérome Perrin
gitlab-ce
Commits
16a83724
Commit
16a83724
authored
Nov 30, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pipeline config source specs and test it explicitly
parent
9293842d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
41 deletions
+38
-41
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+38
-41
No files found.
spec/models/ci/pipeline_spec.rb
View file @
16a83724
...
@@ -868,62 +868,59 @@ describe Ci::Pipeline, :mailer do
...
@@ -868,62 +868,59 @@ describe Ci::Pipeline, :mailer do
end
end
describe
'#set_config_source'
do
describe
'#set_config_source'
do
context
'on object initialisation'
do
context
'when pipelines does not contain needed data'
do
context
'when pipelines does not contain needed data'
do
it
'defines source to be unknown'
do
let
(
:pipeline
)
do
pipeline
.
set_config_source
Ci
::
Pipeline
.
new
end
it
'defines source to be unknown'
do
expect
(
pipeline
).
to
be_unknown_source
expect
(
pipeline
).
to
be_unknown_source
end
end
end
end
context
'when pipeline contains all needed data'
do
context
'when pipeline contains all needed data'
do
let
(
:pipeline
)
do
let
(
:pipeline
)
do
Ci
::
Pipeline
.
new
(
create
(
:ci_pipeline
,
project:
project
,
project:
project
,
sha:
'1234'
,
sha:
'1234'
,
ref:
'master'
,
ref:
'master'
,
source: :push
)
source: :push
)
end
context
'when the repository has a config file'
do
before
do
allow
(
project
.
repository
).
to
receive
(
:gitlab_ci_yml_for
)
.
and_return
(
'config'
)
end
end
context
'when the repository has a config file'
do
it
'defines source to be from repository'
do
before
do
pipeline
.
set_config_source
allow
(
project
.
repository
).
to
receive
(
:gitlab_ci_yml_for
)
.
and_return
(
'config'
)
end
it
'defines source to be from repository'
do
expect
(
pipeline
).
to
be_repository_source
expect
(
pipeline
).
to
be_repository_source
end
end
context
'when loading an object'
do
context
'when loading an object'
do
let
(
:new_pipeline
)
{
Ci
::
Pipeline
.
find
(
pipeline
.
id
)
}
let
(
:new_pipeline
)
{
Ci
::
Pipeline
.
find
(
pipeline
.
id
)
}
it
'does not redefine the source'
do
it
'does not redefine the source'
do
# force to overwrite the source
# force to overwrite the source
pipeline
.
unknown_source!
pipeline
.
unknown_source!
expect
(
new_pipeline
).
to
be_unknown_source
expect
(
new_pipeline
).
to
be_unknown_source
end
end
end
end
end
end
context
'when the repository does not have a config file'
do
context
'when the repository does not have a config file'
do
let
(
:implied_yml
)
{
Gitlab
::
Template
::
GitlabCiYmlTemplate
.
find
(
'Auto-DevOps'
).
content
}
let
(
:implied_yml
)
{
Gitlab
::
Template
::
GitlabCiYmlTemplate
.
find
(
'Auto-DevOps'
).
content
}
context
'auto devops enabled'
do
context
'auto devops enabled'
do
before
do
before
do
stub_application_setting
(
auto_devops_enabled:
true
)
stub_application_setting
(
auto_devops_enabled:
true
)
allow
(
project
).
to
receive
(
:ci_config_path
)
{
'custom'
}
allow
(
project
).
to
receive
(
:ci_config_path
)
{
'custom'
}
end
end
it
'defines source to be auto devops'
do
it
'defines source to be auto devops'
do
subject
pipeline
.
set_config_source
expect
(
pipeline
).
to
be_auto_devops_source
expect
(
pipeline
).
to
be_auto_devops_source
end
end
end
end
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