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
80b94298
Commit
80b94298
authored
Aug 22, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests
parent
ba076a68
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
4 deletions
+26
-4
app/models/ci/build.rb
app/models/ci/build.rb
+1
-1
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+1
-1
spec/ee/spec/models/ee/ci/build_spec.rb
spec/ee/spec/models/ee/ci/build_spec.rb
+22
-0
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+2
-2
No files found.
app/models/ci/build.rb
View file @
80b94298
...
...
@@ -37,7 +37,7 @@ module Ci
scope
:with_expired_artifacts
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at < ?'
,
Time
.
now
)
}
scope
:last_month
,
->
()
{
where
(
'created_at > ?'
,
Date
.
today
-
1
.
month
)
}
scope
:manual_actions
,
->
()
{
where
(
when: :manual
,
status:
COMPLETED_STATUSES
+
[
:manual
])
}
scope
:code
climate
,
->
()
{
where
(
name:
%w[codequality codeclimate]
)
}
scope
:code
quality
,
->
()
{
where
(
name:
%w[codequality codeclimate]
)
}
mount_uploader
:artifacts_file
,
ArtifactUploader
mount_uploader
:artifacts_metadata
,
ArtifactUploader
...
...
app/models/ci/pipeline.rb
View file @
80b94298
...
...
@@ -442,7 +442,7 @@ module Ci
end
def
codeclimate_artifact
artifacts
.
code
climate
.
find
(
&
:has_codeclimate_json?
)
artifacts
.
code
quality
.
find
(
&
:has_codeclimate_json?
)
end
private
...
...
spec/ee/spec/models/ee/ci/build_spec.rb
View file @
80b94298
...
...
@@ -12,6 +12,28 @@ describe Ci::Build do
let
(
:job
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
describe
'.codequality'
do
subject
{
described_class
.
codequality
}
context
'when a job name is codequality'
do
let!
(
:job
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
name:
'codequality'
)
}
it
{
is_expected
.
to
include
(
job
)
}
end
context
'when a job name is codeclimate'
do
let!
(
:job
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
name:
'codeclimate'
)
}
it
{
is_expected
.
to
include
(
job
)
}
end
context
'when a job name is irrelevant'
do
let!
(
:job
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
name:
'codechecker'
)
}
it
{
is_expected
.
not_to
include
(
job
)
}
end
end
describe
'#shared_runners_minutes_limit_enabled?'
do
subject
{
job
.
shared_runners_minutes_limit_enabled?
}
...
...
spec/models/ci/pipeline_spec.rb
View file @
80b94298
...
...
@@ -1325,7 +1325,7 @@ describe Ci::Pipeline, :mailer do
end
describe
'#codeclimate_artifact'
do
context
'has code
climate build
'
do
context
'has code
quality job
'
do
let!
(
:build
)
do
create
(
:ci_build
,
...
...
@@ -1343,7 +1343,7 @@ describe Ci::Pipeline, :mailer do
it
{
expect
(
pipeline
.
codeclimate_artifact
).
to
eq
(
build
)
}
end
context
'no code
climate build
'
do
context
'no code
quality job
'
do
before
do
create
(
:ci_build
,
pipeline:
pipeline
)
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