BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
37881ebb
Commit
37881ebb
authored
Aug 22, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set a default CI/CD status when it is not known
parent
78a0d27e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
stage.rb
app/models/ci/stage.rb
+4
-0
stage_spec.rb
spec/models/ci/stage_spec.rb
+11
-0
No files found.
app/models/ci/stage.rb
View file @
37881ebb
...
...
@@ -17,6 +17,10 @@ module Ci
validates
:pipeline
,
presence:
true
,
unless: :importing?
validates
:name
,
presence:
true
,
unless: :importing?
after_initialize
do
|
stage
|
self
.
status
=
DEFAULT_STATUS
if
self
.
status
.
nil?
end
state_machine
:status
,
initial: :created
do
event
:enqueue
do
transition
created: :pending
...
...
spec/models/ci/stage_spec.rb
View file @
37881ebb
...
...
@@ -38,6 +38,17 @@ describe Ci::Stage, :models do
expect
(
stage
.
status
).
to
eq
'success'
end
end
context
'when stage status is not defined'
do
before
do
stage
.
update_column
(
:status
,
nil
)
end
it
'sets the default value'
do
expect
(
described_class
.
find
(
stage
.
id
).
status
)
.
to
eq
'created'
end
end
end
describe
'update_status'
do
...
...
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