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
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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
commit.rb
app/models/ci/commit.rb
+2
-1
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