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
2cc0c692
Unverified
Commit
2cc0c692
authored
Apr 10, 2018
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that enqueuing a commit status always sets 'queued_at' value
parent
2c7f0766
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
commit_status.rb
app/models/commit_status.rb
+1
-1
commit_status_spec.rb
spec/models/commit_status_spec.rb
+32
-0
No files found.
app/models/commit_status.rb
View file @
2cc0c692
...
...
@@ -87,7 +87,7 @@ class CommitStatus < ActiveRecord::Base
transition
[
:created
,
:pending
,
:running
,
:manual
]
=>
:canceled
end
before_transition
created:
[
:pending
,
:running
]
do
|
commit_status
|
before_transition
[
:created
,
:skipped
,
:manual
]
=>
:pending
do
|
commit_status
|
commit_status
.
queued_at
=
Time
.
now
end
...
...
spec/models/commit_status_spec.rb
View file @
2cc0c692
...
...
@@ -533,4 +533,36 @@ describe CommitStatus do
end
end
end
describe
'#enqueue'
do
let!
(
:current_time
)
{
Time
.
new
(
2018
,
4
,
5
,
14
,
0
,
0
)
}
before
do
allow
(
Time
).
to
receive
(
:now
).
and_return
(
current_time
)
end
shared_examples
'commit status enqueued'
do
it
'sets queued_at value when enqueued'
do
expect
{
commit_status
.
enqueue
}.
to
change
{
commit_status
.
reload
.
queued_at
}.
from
(
nil
).
to
(
current_time
)
end
end
context
'when initial state is :created'
do
let
(
:commit_status
)
{
create
(
:commit_status
,
:created
)
}
it_behaves_like
'commit status enqueued'
end
context
'when initial state is :skipped'
do
let
(
:commit_status
)
{
create
(
:commit_status
,
:skipped
)
}
it_behaves_like
'commit status enqueued'
end
context
'when initial state is :manual'
do
let
(
:commit_status
)
{
create
(
:commit_status
,
:manual
)
}
it_behaves_like
'commit status enqueued'
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