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
693da4d7
Commit
693da4d7
authored
Nov 15, 2019
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consolidated expectations into fewer create_pipeline_service/rules specs
parent
afed50a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
75 deletions
+30
-75
spec/services/ci/create_pipeline_service/rules_spec.rb
spec/services/ci/create_pipeline_service/rules_spec.rb
+30
-75
No files found.
spec/services/ci/create_pipeline_service/rules_spec.rb
View file @
693da4d7
...
...
@@ -114,48 +114,36 @@ describe Ci::CreatePipelineService do
end
context
'matching the first rule in the list'
do
it
'saves the pipeline'
do
expect
(
pipeline
).
to
be_persisted
end
it
'sets the pipeline state to pending'
do
it
'saves a pending pipeline'
do
expect
(
pipeline
).
to
be_pending
expect
(
pipeline
).
to
be_persisted
end
end
context
'matching the last rule in the list'
do
let
(
:ref
)
{
'refs/heads/feature'
}
it
'saves the pipeline'
do
expect
(
pipeline
).
to
be_persisted
end
it
'sets the pipeline state to pending'
do
it
'saves a pending pipeline'
do
expect
(
pipeline
).
to
be_pending
expect
(
pipeline
).
to
be_persisted
end
end
context
'matching the when:never rule'
do
let
(
:ref
)
{
'refs/heads/wip'
}
it
'does not save the pipeline'
do
expect
(
pipeline
).
not_to
be_persisted
end
it
'attaches errors'
do
it
'invalidates the pipeline with a workflow rules error'
do
expect
(
pipeline
.
errors
[
:base
]).
to
include
(
'Pipeline filtered out by workflow rules.'
)
expect
(
pipeline
).
not_to
be_persisted
end
end
context
'matching no rules in the list'
do
let
(
:ref
)
{
'refs/heads/fix'
}
it
'does not save the pipeline'
do
expect
(
pipeline
).
not_to
be_persisted
end
it
'attaches errors'
do
it
'invalidates the pipeline with a workflow rules error'
do
expect
(
pipeline
.
errors
[
:base
]).
to
include
(
'Pipeline filtered out by workflow rules.'
)
expect
(
pipeline
).
not_to
be_persisted
end
end
end
...
...
@@ -176,12 +164,9 @@ describe Ci::CreatePipelineService do
end
context
'matching the first rule in the list'
do
it
'saves the pipeline'
do
expect
(
pipeline
).
to
be_persisted
end
it
'sets the pipeline state to pending'
do
it
'saves a pending pipeline'
do
expect
(
pipeline
).
to
be_pending
expect
(
pipeline
).
to
be_persisted
end
end
end
...
...
@@ -204,24 +189,18 @@ describe Ci::CreatePipelineService do
context
'with partial match'
do
let
(
:ref
)
{
'refs/heads/feature'
}
it
'saves the pipeline'
do
expect
(
pipeline
).
to
be_persisted
end
it
'sets the pipeline state to pending'
do
it
'saves a pending pipeline'
do
expect
(
pipeline
).
to
be_pending
expect
(
pipeline
).
to
be_persisted
end
end
context
'with complete match'
do
let
(
:ref
)
{
'refs/heads/feature_conflict'
}
it
'does not save the pipeline'
do
expect
(
pipeline
).
not_to
be_persisted
end
it
'attaches errors'
do
it
'invalidates the pipeline with a workflow rules error'
do
expect
(
pipeline
.
errors
[
:base
]).
to
include
(
'Pipeline filtered out by workflow rules.'
)
expect
(
pipeline
).
not_to
be_persisted
end
end
end
...
...
@@ -245,12 +224,9 @@ describe Ci::CreatePipelineService do
context
'where workflow passes and the job fails'
do
let
(
:ref
)
{
'refs/heads/master'
}
it
'does not save the pipeline'
do
expect
(
pipeline
).
not_to
be_persisted
end
it
'attaches an error about no job in the pipeline'
do
it
'invalidates the pipeline with an empty jobs error'
do
expect
(
pipeline
.
errors
[
:base
]).
to
include
(
'No stages / jobs for this pipeline.'
)
expect
(
pipeline
).
not_to
be_persisted
end
context
'with workflow:rules shut off'
do
...
...
@@ -258,12 +234,9 @@ describe Ci::CreatePipelineService do
stub_feature_flags
(
workflow_rules:
false
)
end
it
'does not save the pipeline'
do
expect
(
pipeline
).
not_to
be_persisted
end
it
'attaches an error about no job in the pipeline'
do
it
'invalidates the pipeline with an empty jobs error'
do
expect
(
pipeline
.
errors
[
:base
]).
to
include
(
'No stages / jobs for this pipeline.'
)
expect
(
pipeline
).
not_to
be_persisted
end
end
end
...
...
@@ -271,12 +244,9 @@ describe Ci::CreatePipelineService do
context
'where workflow passes and the job passes'
do
let
(
:ref
)
{
'refs/heads/feature'
}
it
'saves the pipeline'
do
expect
(
pipeline
).
to
be_persisted
end
it
'sets the pipeline state to pending'
do
it
'saves a pending pipeline'
do
expect
(
pipeline
).
to
be_pending
expect
(
pipeline
).
to
be_persisted
end
context
'with workflow:rules shut off'
do
...
...
@@ -284,12 +254,9 @@ describe Ci::CreatePipelineService do
stub_feature_flags
(
workflow_rules:
false
)
end
it
'saves the pipeline'
do
expect
(
pipeline
).
to
be_persisted
end
it
'sets the pipeline state to pending'
do
it
'saves a pending pipeline'
do
expect
(
pipeline
).
to
be_pending
expect
(
pipeline
).
to
be_persisted
end
end
end
...
...
@@ -297,12 +264,9 @@ describe Ci::CreatePipelineService do
context
'where workflow fails and the job fails'
do
let
(
:ref
)
{
'refs/heads/fix'
}
it
'does not save the pipeline'
do
expect
(
pipeline
).
not_to
be_persisted
end
it
'attaches an error about workflow rules'
do
it
'invalidates the pipeline with a workflow rules error'
do
expect
(
pipeline
.
errors
[
:base
]).
to
include
(
'Pipeline filtered out by workflow rules.'
)
expect
(
pipeline
).
not_to
be_persisted
end
context
'with workflow:rules shut off'
do
...
...
@@ -310,12 +274,9 @@ describe Ci::CreatePipelineService do
stub_feature_flags
(
workflow_rules:
false
)
end
it
'does not save the pipeline'
do
expect
(
pipeline
).
not_to
be_persisted
end
it
'attaches an error about job rules'
do
it
'invalidates the pipeline with an empty jobs error'
do
expect
(
pipeline
.
errors
[
:base
]).
to
include
(
'No stages / jobs for this pipeline.'
)
expect
(
pipeline
).
not_to
be_persisted
end
end
end
...
...
@@ -323,12 +284,9 @@ describe Ci::CreatePipelineService do
context
'where workflow fails and the job passes'
do
let
(
:ref
)
{
'refs/heads/wip'
}
it
'does not save the pipeline'
do
expect
(
pipeline
).
not_to
be_persisted
end
it
'attaches an error about workflow rules'
do
it
'invalidates the pipeline with a workflow rules error'
do
expect
(
pipeline
.
errors
[
:base
]).
to
include
(
'Pipeline filtered out by workflow rules.'
)
expect
(
pipeline
).
not_to
be_persisted
end
context
'with workflow:rules shut off'
do
...
...
@@ -336,12 +294,9 @@ describe Ci::CreatePipelineService do
stub_feature_flags
(
workflow_rules:
false
)
end
it
'saves the pipeline'
do
expect
(
pipeline
).
to
be_persisted
end
it
'sets the pipeline state to pending'
do
it
'saves a pending pipeline'
do
expect
(
pipeline
).
to
be_pending
expect
(
pipeline
).
to
be_persisted
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