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
2cc0c692
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
app/models/commit_status.rb
app/models/commit_status.rb
+1
-1
spec/models/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