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
2c5f1aeb
Commit
2c5f1aeb
authored
Dec 18, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more specs for CI/CD bridge class
parent
001ad9c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
1 deletion
+45
-1
ee/app/workers/ci/create_cross_project_pipeline_worker.rb
ee/app/workers/ci/create_cross_project_pipeline_worker.rb
+2
-0
ee/spec/models/ci/bridge_spec.rb
ee/spec/models/ci/bridge_spec.rb
+43
-1
No files found.
ee/app/workers/ci/create_cross_project_pipeline_worker.rb
View file @
2c5f1aeb
...
...
@@ -5,6 +5,7 @@ module Ci
include
::
ApplicationWorker
include
::
PipelineQueue
# rubocop:disable CodeReuse/ActiveRecord
def
perform
(
bridge_id
)
::
Ci
::
Bridge
.
find_by
(
id:
bridge_id
).
try
do
|
bridge
|
::
Ci
::
CreateCrossProjectPipelineService
...
...
@@ -12,5 +13,6 @@ module Ci
.
execute
(
bridge
)
end
end
# rubocop:enable CodeReuse/ActiveRecord
end
end
ee/spec/models/ci/bridge_spec.rb
View file @
2c5f1aeb
...
...
@@ -5,7 +5,11 @@ describe Ci::Bridge do
set
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:bridge
)
do
create
(
:ci_bridge
,
status: :created
,
pipeline:
pipeline
)
create
(
:ci_bridge
,
status: :created
,
options:
options
,
pipeline:
pipeline
)
end
let
(
:options
)
do
{
trigger:
{
project:
'my/project'
,
branch:
'master'
}
}
end
it
'has many sourced pipelines'
do
...
...
@@ -21,4 +25,42 @@ describe Ci::Bridge do
end
end
end
describe
'#target_user'
do
it
'is the same as a user who created a pipeline'
do
expect
(
bridge
.
target_user
).
to
eq
bridge
.
user
end
end
describe
'#target_project_name'
do
context
'when trigger is defined'
do
it
'returns a full path of a project'
do
expect
(
bridge
.
target_project_name
).
to
eq
'my/project'
end
end
context
'when trigger does not have project defined'
do
let
(
:options
)
{
{
trigger:
{}
}
}
it
'returns nil'
do
expect
(
bridge
.
target_project_name
).
to
be_nil
end
end
end
describe
'#target_ref'
do
context
'when trigger is defined'
do
it
'returns a ref name'
do
expect
(
bridge
.
target_ref
).
to
eq
'master'
end
end
context
'when trigger does not have project defined'
do
let
(
:options
)
{
nil
}
it
'returns nil'
do
expect
(
bridge
.
target_ref
).
to
be_nil
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