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
87d1a814
Commit
87d1a814
authored
Jun 01, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for MergeRequest#has_codeclimate_data?
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
2253c084
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
app/models/merge_request.rb
app/models/merge_request.rb
+2
-2
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+17
-0
No files found.
app/models/merge_request.rb
View file @
87d1a814
...
...
@@ -1000,7 +1000,7 @@ class MergeRequest < ActiveRecord::Base
end
def
has_codeclimate_data?
head_codeclimate_artifact
&
.
success?
&&
base_codeclimate_artifact
&
.
success?
!!
(
head_codeclimate_artifact
&
.
success?
&&
base_codeclimate_artifact
&
.
success?
)
end
end
spec/models/merge_request_spec.rb
View file @
87d1a814
...
...
@@ -2093,4 +2093,21 @@ describe MergeRequest, models: true do
expect
(
subject
.
head_codeclimate_artifact
).
to
eq
(
1
)
end
end
describe
'#has_codeclimate_data?'
do
context
'with codeclimate artifact'
do
before
do
artifact
=
double
()
allow
(
artifact
).
to
receive
(
:success?
).
and_return
(
true
)
allow
(
subject
.
head_pipeline
).
to
receive
(
:codeclimate_artifact
).
and_return
(
artifact
)
allow
(
subject
.
base_pipeline
).
to
receive
(
:codeclimate_artifact
).
and_return
(
artifact
)
end
it
{
expect
(
subject
.
has_codeclimate_data?
).
to
be_truthy
}
end
context
'without codeclimate artifact'
do
it
{
expect
(
subject
.
has_codeclimate_data?
).
to
be_falsey
}
end
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