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
0390115d
Commit
0390115d
authored
Oct 28, 2020
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Declare one pipeline with coverage builds and let_it_be
parent
84c708c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
19 deletions
+11
-19
spec/lib/gitlab/badge/coverage/report_spec.rb
spec/lib/gitlab/badge/coverage/report_spec.rb
+11
-19
No files found.
spec/lib/gitlab/badge/coverage/report_spec.rb
View file @
0390115d
...
...
@@ -3,15 +3,21 @@
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Badge
::
Coverage
::
Report
do
let
(
:project
)
{
build
(
:project
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:pipeline
)
{
create
(
:ci_pipeline
,
:success
,
project:
project
)
}
let_it_be
(
:builds
)
do
[
create
(
:ci_build
,
:success
,
pipeline:
pipeline
,
coverage:
40
,
name:
'first'
),
create
(
:ci_build
,
:success
,
pipeline:
pipeline
,
coverage:
60
)
]
end
let
(
:badge
)
do
described_class
.
new
(
project
,
'master'
,
opts:
{
job:
job_name
})
end
let
(
:pipeline
)
{
nil
}
let
(
:job_name
)
{
nil
}
let
(
:builds
)
{
[]
}
describe
'#entity'
do
it
'describes a coverage'
do
...
...
@@ -37,6 +43,8 @@ RSpec.describe Gitlab::Badge::Coverage::Report do
end
context
'with no pipeline'
do
let
(
:pipeline
)
{
nil
}
it
'returns nil'
do
expect
(
badge
.
status
).
to
be_nil
end
...
...
@@ -52,14 +60,6 @@ RSpec.describe Gitlab::Badge::Coverage::Report do
context
'with an unmatching job name specified'
do
let
(
:job_name
)
{
'incorrect name'
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
:success
,
builds:
builds
)
}
let
(
:builds
)
do
[
create
(
:ci_build
,
:success
,
name:
'first'
,
coverage:
40
),
create
(
:ci_build
,
:success
,
coverage:
60
)
]
end
it
'returns nil'
do
expect
(
badge
.
status
).
to
eq
(
nil
)
...
...
@@ -68,14 +68,6 @@ RSpec.describe Gitlab::Badge::Coverage::Report do
context
'with a matching job name specified'
do
let
(
:job_name
)
{
'first'
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
:success
,
builds:
builds
)
}
let
(
:builds
)
do
[
create
(
:ci_build
,
:success
,
name:
'first'
,
coverage:
40
),
create
(
:ci_build
,
:success
,
coverage:
60
)
]
end
it
'returns nil'
do
expect
(
badge
.
status
).
to
eq
(
40.00
)
...
...
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