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
d0451a05
Commit
d0451a05
authored
Jul 12, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for Project#builds_for and return empty array for nothing
parent
2c646bb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
project.rb
app/models/project.rb
+3
-0
project_spec.rb
spec/models/project_spec.rb
+15
-1
No files found.
app/models/project.rb
View file @
d0451a05
...
...
@@ -430,6 +430,9 @@ class Project < ActiveRecord::Base
end
def
builds_for
(
build_name
,
ref
=
'HEAD'
)
ct
=
commit
(
ref
)
return
[]
unless
ct
sha
=
commit
(
ref
).
sha
builds
.
joins
(
:pipeline
).
...
...
spec/models/project_spec.rb
View file @
d0451a05
...
...
@@ -359,11 +359,25 @@ describe Project, models: true do
describe
:repository
do
let
(
:project
)
{
create
(
:project
)
}
it
'
should return
valid repo'
do
it
'
returns
valid repo'
do
expect
(
project
.
repository
).
to
be_kind_of
(
Repository
)
end
end
describe
'#builds_for'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
sha
)
end
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
it
'returns builds for a particular ref'
do
build_ids
=
project
.
builds_for
(
build
.
name
,
build
.
sha
).
map
(
&
:id
)
expect
(
build_ids
).
to
eq
([
build
.
id
])
end
end
describe
:default_issues_tracker?
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:ext_project
)
{
create
(
:redmine_project
)
}
...
...
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