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
Boxiang Sun
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
app/models/ci/stage.rb
app/models/ci/stage.rb
+4
-0
spec/models/ci/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