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
058f27ad
Commit
058f27ad
authored
Dec 21, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'coverage-regex' into 'master'
Fix build coverage regex matching to allow captures. Fixes #2644 /cc @DouweM See merge request !2138
parents
545a9434
5a3237fd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
build.rb
app/models/ci/build.rb
+2
-1
build_spec.rb
spec/models/build_spec.rb
+6
-0
No files found.
app/models/ci/build.rb
View file @
058f27ad
...
...
@@ -170,7 +170,8 @@ module Ci
def
extract_coverage
(
text
,
regex
)
begin
matches
=
text
.
gsub
(
Regexp
.
new
(
regex
)).
to_a
.
last
matches
=
text
.
scan
(
Regexp
.
new
(
regex
)).
last
matches
=
matches
.
last
if
matches
.
kind_of?
(
Array
)
coverage
=
matches
.
gsub
(
/\d+(\.\d+)?/
).
first
if
coverage
.
present?
...
...
spec/models/build_spec.rb
View file @
058f27ad
...
...
@@ -189,6 +189,12 @@ describe Ci::Build, models: true do
it
{
is_expected
.
to
eq
(
98.29
)
}
end
context
'using a regex capture'
do
subject
{
build
.
extract_coverage
(
'TOTAL 9926 3489 65%'
,
'TOTAL\s+\d+\s+\d+\s+(\d{1,3}\%)'
)
}
it
{
is_expected
.
to
eq
(
65
)
}
end
end
describe
:variables
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