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
c88075f4
Commit
c88075f4
authored
Jul 12, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix markdown rendering for consecutive label references
parent
4be505bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
1 deletion
+41
-1
label.rb
app/models/label.rb
+1
-1
label_reference_filter_spec.rb
spec/lib/banzai/filter/label_reference_filter_spec.rb
+40
-0
No files found.
app/models/label.rb
View file @
c88075f4
...
@@ -59,7 +59,7 @@ class Label < ActiveRecord::Base
...
@@ -59,7 +59,7 @@ class Label < ActiveRecord::Base
(?<label_id>
\d
+) | # Integer-based label ID, or
(?<label_id>
\d
+) | # Integer-based label ID, or
(?<label_name>
(?<label_name>
[A-Za-z0-9_
\-\?
&]+ | # String-based single-word label title, or
[A-Za-z0-9_
\-\?
&]+ | # String-based single-word label title, or
"
[^,]+"
# String-based multi-word label surrounded in quotes
"
([^"]*)"
# String-based multi-word label surrounded in quotes
)
)
)
)
}x
}x
...
...
spec/lib/banzai/filter/label_reference_filter_spec.rb
View file @
c88075f4
...
@@ -178,6 +178,46 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
...
@@ -178,6 +178,46 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
end
end
end
end
describe
'consecutive references'
do
let
(
:bug
)
{
create
(
:label
,
name:
'bug'
,
project:
project
)
}
let
(
:feature_proposal
)
{
create
(
:label
,
name:
'feature proposal'
,
project:
project
)
}
let
(
:technical_debt
)
{
create
(
:label
,
name:
'technical debt'
,
project:
project
)
}
let
(
:bug_reference
)
{
"
#{
Label
.
reference_prefix
}#{
bug
.
name
}
"
}
let
(
:feature_proposal_reference
)
{
feature_proposal
.
to_reference
(
format: :name
)
}
let
(
:technical_debt_reference
)
{
technical_debt
.
to_reference
(
format: :name
)
}
context
'separated with a comma'
do
let
(
:references
)
{
"
#{
bug_reference
}
,
#{
feature_proposal_reference
}
,
#{
technical_debt_reference
}
"
}
it
'links to valid references'
do
doc
=
reference_filter
(
"See
#{
references
}
"
)
expect
(
doc
.
css
(
'a'
).
map
{
|
a
|
a
.
attr
(
'href'
)
}).
to
match_array
([
urls
.
namespace_project_issues_url
(
project
.
namespace
,
project
,
label_name:
bug
.
name
),
urls
.
namespace_project_issues_url
(
project
.
namespace
,
project
,
label_name:
feature_proposal
.
name
),
urls
.
namespace_project_issues_url
(
project
.
namespace
,
project
,
label_name:
technical_debt
.
name
)
])
expect
(
doc
.
text
).
to
eq
'See bug, feature proposal, technical debt'
end
end
context
'separated with a space'
do
let
(
:references
)
{
"
#{
bug_reference
}
#{
feature_proposal_reference
}
#{
technical_debt_reference
}
"
}
it
'links to valid references'
do
doc
=
reference_filter
(
"See
#{
references
}
"
)
expect
(
doc
.
css
(
'a'
).
map
{
|
a
|
a
.
attr
(
'href'
)
}).
to
match_array
([
urls
.
namespace_project_issues_url
(
project
.
namespace
,
project
,
label_name:
bug
.
name
),
urls
.
namespace_project_issues_url
(
project
.
namespace
,
project
,
label_name:
feature_proposal
.
name
),
urls
.
namespace_project_issues_url
(
project
.
namespace
,
project
,
label_name:
technical_debt
.
name
)
])
expect
(
doc
.
text
).
to
eq
'See bug feature proposal technical debt'
end
end
end
describe
'edge cases'
do
describe
'edge cases'
do
it
'gracefully handles non-references matching the pattern'
do
it
'gracefully handles non-references matching the pattern'
do
exp
=
act
=
'(format nil "~0f" 3.0) ; 3.0'
exp
=
act
=
'(format nil "~0f" 3.0) ; 3.0'
...
...
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