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
eab5215b
Commit
eab5215b
authored
Apr 15, 2020
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor delegation tests in favor of "delegate_method" matcher
parent
8a7fe44e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
109 deletions
+8
-109
ee/spec/models/ci/processable_spec.rb
ee/spec/models/ci/processable_spec.rb
+3
-34
spec/models/ci/processable_spec.rb
spec/models/ci/processable_spec.rb
+5
-75
No files found.
ee/spec/models/ci/processable_spec.rb
View file @
eab5215b
...
...
@@ -3,40 +3,9 @@
require
'spec_helper'
describe
Ci
::
Processable
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
describe
'delegations'
do
subject
{
Ci
::
Processable
.
new
}
let_it_be
(
:detached_merge_request_pipeline
)
do
create
(
:ci_pipeline
,
:detached_merge_request_pipeline
,
:with_job
,
project:
project
)
end
let_it_be
(
:legacy_detached_merge_request_pipeline
)
do
create
(
:ci_pipeline
,
:legacy_detached_merge_request_pipeline
,
:with_job
,
project:
project
)
end
let_it_be
(
:merged_result_pipeline
)
do
create
(
:ci_pipeline
,
:merged_result_pipeline
,
:with_job
,
project:
project
)
end
describe
'#merge_train_pipeline?'
do
subject
{
pipeline
.
processables
.
first
.
merge_train_pipeline?
}
context
'in a detached merge request pipeline'
do
let
(
:pipeline
)
{
detached_merge_request_pipeline
}
it
{
is_expected
.
to
eq
(
pipeline
.
merge_train_pipeline?
)
}
end
context
'in a legacy detached merge_request_pipeline'
do
let
(
:pipeline
)
{
legacy_detached_merge_request_pipeline
}
it
{
is_expected
.
to
eq
(
pipeline
.
merge_train_pipeline?
)
}
end
context
'in a pipeline for merged results'
do
let
(
:pipeline
)
{
merged_result_pipeline
}
it
{
is_expected
.
to
eq
(
pipeline
.
merge_train_pipeline?
)
}
end
it
{
is_expected
.
to
delegate_method
(
:merge_train_pipeline?
).
to
(
:pipeline
)
}
end
end
spec/models/ci/processable_spec.rb
View file @
eab5215b
...
...
@@ -6,16 +6,12 @@ describe Ci::Processable do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let_it_be
(
:detached_merge_request_pipeline
)
do
create
(
:ci_pipeline
,
:detached_merge_request_pipeline
,
:with_job
,
project:
project
)
end
let_it_be
(
:legacy_detached_merge_request_pipeline
)
do
create
(
:ci_pipeline
,
:legacy_detached_merge_request_pipeline
,
:with_job
,
project:
project
)
end
describe
'delegations'
do
subject
{
Ci
::
Processable
.
new
}
let_it_be
(
:merged_result_pipeline
)
do
create
(
:ci_pipeline
,
:merged_result_pipeline
,
:with_job
,
project:
project
)
it
{
is_expected
.
to
delegate_method
(
:merge_request?
).
to
(
:pipeline
)
}
it
{
is_expected
.
to
delegate_method
(
:merge_request_ref?
).
to
(
:pipeline
)
}
it
{
is_expected
.
to
delegate_method
(
:legacy_detached_merge_request_pipeline?
).
to
(
:pipeline
)
}
end
describe
'#aggregated_needs_names'
do
...
...
@@ -132,70 +128,4 @@ describe Ci::Processable do
it
{
is_expected
.
to
be_empty
}
end
end
describe
'#merge_request?'
do
subject
{
pipeline
.
processables
.
first
.
merge_request?
}
context
'in a detached merge request pipeline'
do
let
(
:pipeline
)
{
detached_merge_request_pipeline
}
it
{
is_expected
.
to
eq
(
pipeline
.
merge_request?
)
}
end
context
'in a legacy detached merge_request_pipeline'
do
let
(
:pipeline
)
{
legacy_detached_merge_request_pipeline
}
it
{
is_expected
.
to
eq
(
pipeline
.
merge_request?
)
}
end
context
'in a pipeline for merged results'
do
let
(
:pipeline
)
{
merged_result_pipeline
}
it
{
is_expected
.
to
eq
(
pipeline
.
merge_request?
)
}
end
end
describe
'#merge_request_ref?'
do
subject
{
pipeline
.
processables
.
first
.
merge_request_ref?
}
context
'in a detached merge request pipeline'
do
let
(
:pipeline
)
{
detached_merge_request_pipeline
}
it
{
is_expected
.
to
eq
(
pipeline
.
merge_request_ref?
)
}
end
context
'in a legacy detached merge_request_pipeline'
do
let
(
:pipeline
)
{
legacy_detached_merge_request_pipeline
}
it
{
is_expected
.
to
eq
(
pipeline
.
merge_request_ref?
)
}
end
context
'in a pipeline for merged results'
do
let
(
:pipeline
)
{
merged_result_pipeline
}
it
{
is_expected
.
to
eq
(
pipeline
.
merge_request_ref?
)
}
end
end
describe
'#legacy_detached_merge_request_pipeline?'
do
subject
{
pipeline
.
processables
.
first
.
legacy_detached_merge_request_pipeline?
}
context
'in a detached merge request pipeline'
do
let
(
:pipeline
)
{
detached_merge_request_pipeline
}
it
{
is_expected
.
to
eq
(
pipeline
.
legacy_detached_merge_request_pipeline?
)
}
end
context
'in a legacy detached merge_request_pipeline'
do
let
(
:pipeline
)
{
legacy_detached_merge_request_pipeline
}
it
{
is_expected
.
to
eq
(
pipeline
.
legacy_detached_merge_request_pipeline?
)
}
end
context
'in a pipeline for merged results'
do
let
(
:pipeline
)
{
merged_result_pipeline
}
it
{
is_expected
.
to
eq
(
pipeline
.
legacy_detached_merge_request_pipeline?
)
}
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