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
Kazuhiko Shiozaki
gitlab-ce
Commits
c9853897
Commit
c9853897
authored
Oct 05, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add stage tests
parent
fb12b81b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
app/models/ci/commit.rb
app/models/ci/commit.rb
+2
-1
spec/models/ci/commit_spec.rb
spec/models/ci/commit_spec.rb
+34
-0
No files found.
app/models/ci/commit.rb
View file @
c9853897
...
@@ -81,7 +81,8 @@ module Ci
...
@@ -81,7 +81,8 @@ module Ci
end
end
def
stage
def
stage
builds_without_retry
.
group
(
:stage_idx
).
select
(
:stage
).
last
running_or_pending
=
builds_without_retry
.
running_or_pending
running_or_pending
.
limit
(
1
).
pluck
(
:stage
).
first
end
end
def
create_builds
(
ref
,
tag
,
user
,
trigger_request
=
nil
)
def
create_builds
(
ref
,
tag
,
user
,
trigger_request
=
nil
)
...
...
spec/models/ci/commit_spec.rb
View file @
c9853897
...
@@ -74,6 +74,40 @@ describe Ci::Commit do
...
@@ -74,6 +74,40 @@ describe Ci::Commit do
it
{
expect
(
commit
.
sha
).
to
start_with
(
subject
)
}
it
{
expect
(
commit
.
sha
).
to
start_with
(
subject
)
}
end
end
describe
:stage
do
subject
{
commit
.
stage
}
before
do
@second
=
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
name:
'deploy'
,
stage:
'deploy'
,
stage_idx:
1
,
status: :pending
@first
=
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
name:
'test'
,
stage:
'test'
,
stage_idx:
0
,
status: :pending
end
it
'returns first running stage'
do
is_expected
.
to
eq
(
'test'
)
end
context
'first build succeeded'
do
before
do
@first
.
update_attributes
(
status: :success
)
end
it
'returns last running stage'
do
is_expected
.
to
eq
(
'deploy'
)
end
end
context
'all builds succeeded'
do
before
do
@first
.
update_attributes
(
status: :success
)
@second
.
update_attributes
(
status: :success
)
end
it
'returns nil'
do
is_expected
.
to
be_nil
end
end
end
describe
:create_next_builds
do
describe
:create_next_builds
do
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