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
cfd7c445
Commit
cfd7c445
authored
Jul 20, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Project#latest_successful_builds_for to project_spec.rb
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5347#note_13173313
parent
dc6afd57
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
34 deletions
+43
-34
build_spec.rb
spec/models/build_spec.rb
+0
-34
project_spec.rb
spec/models/project_spec.rb
+43
-0
No files found.
spec/models/build_spec.rb
View file @
cfd7c445
...
...
@@ -674,40 +674,6 @@ describe Ci::Build, models: true do
end
end
describe
'Project#latest_successful_builds_for'
do
let!
(
:build
)
do
create
(
:ci_build
,
:artifacts
,
:success
,
pipeline:
pipeline
)
end
context
'with succeed pipeline'
do
it
'returns builds for ref for default_branch'
do
builds
=
project
.
latest_successful_builds_for
expect
(
builds
).
to
contain_exactly
(
build
)
end
it
'returns empty relation if the build cannot be found'
do
builds
=
project
.
latest_successful_builds_for
(
'TAIL'
)
expect
(
builds
).
to
be_kind_of
(
ActiveRecord
::
Relation
)
expect
(
builds
).
to
be_empty
end
end
context
'with pending pipeline'
do
before
do
pipeline
.
update
(
status:
'pending'
)
end
it
'returns empty relation'
do
builds
=
project
.
latest_successful_builds_for
expect
(
builds
).
to
be_kind_of
(
ActiveRecord
::
Relation
)
expect
(
builds
).
to
be_empty
end
end
end
describe
'#manual?'
do
before
do
build
.
update
(
when:
value
)
...
...
spec/models/project_spec.rb
View file @
cfd7c445
...
...
@@ -1114,6 +1114,49 @@ describe Project, models: true do
end
end
describe
'#latest_successful_builds_for'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
ref:
project
.
default_branch
,
status:
'success'
)
end
let!
(
:build
)
do
create
(
:ci_build
,
:artifacts
,
:success
,
pipeline:
pipeline
)
end
context
'with succeed pipeline'
do
it
'returns builds for ref for default_branch'
do
builds
=
project
.
latest_successful_builds_for
expect
(
builds
).
to
contain_exactly
(
build
)
end
it
'returns empty relation if the build cannot be found'
do
builds
=
project
.
latest_successful_builds_for
(
'TAIL'
)
expect
(
builds
).
to
be_kind_of
(
ActiveRecord
::
Relation
)
expect
(
builds
).
to
be_empty
end
end
context
'with pending pipeline'
do
before
do
pipeline
.
update
(
status:
'pending'
)
end
it
'returns empty relation'
do
builds
=
project
.
latest_successful_builds_for
expect
(
builds
).
to
be_kind_of
(
ActiveRecord
::
Relation
)
expect
(
builds
).
to
be_empty
end
end
end
describe
'.where_paths_in'
do
context
'without any paths'
do
it
'returns an empty relation'
do
...
...
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