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
0d9f8494
Commit
0d9f8494
authored
Aug 15, 2014
by
Job van der Voort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests to redmine integration improvement
parent
c99f42ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
1 deletion
+50
-1
CHANGELOG-EE
CHANGELOG-EE
+3
-0
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+1
-1
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+46
-0
No files found.
CHANGELOG-EE
View file @
0d9f8494
v 7.2.0
- Improve Redmine integration
v 7.1.0
- Synchronize LDAP-enabled GitLab administrators with an LDAP group (Marvin Frick, sponsored by SinnerSchrader)
- Synchronize SSH keys with LDAP (Oleg Girko (Jolla) and Marvin Frick (SinnerSchrader))
...
...
lib/gitlab/markdown.rb
View file @
0d9f8494
...
...
@@ -193,7 +193,7 @@ module Gitlab
link_to
(
"#
#{
identifier
}
"
,
url
,
options
)
end
elsif
project
.
redmine_tracker?
reference_redmine_issue
(
identifier
,
project
)
reference_redmine_issue
(
identifier
,
project
)
elsif
project
.
jira_tracker?
reference_jira_issue
(
identifier
,
project
)
end
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
0d9f8494
...
...
@@ -229,6 +229,52 @@ describe GitlabMarkdownHelper do
end
end
describe
"referencing a Redmine issue"
do
let
(
:actual
)
{
"Reference to Redmine #
#{
issue
.
iid
}
"
}
let
(
:expected
)
{
"http://redmine.example/issues/
#{
issue
.
iid
}
"
}
let
(
:reference
)
{
"#
#{
issue
.
iid
}
"
}
before
do
issue_tracker_config
=
{
"redmine"
=>
{
"title"
=>
"Redmine tracker"
,
"issues_url"
=>
"http://redmine.example/issues/:id"
}
}
Gitlab
.
config
.
stub
(
:issues_tracker
).
and_return
(
issue_tracker_config
)
@project
.
stub
(
:issues_tracker
).
and_return
(
"redmine"
)
@project
.
stub
(
:issues_tracker_id
).
and_return
(
"REDMINE"
)
end
it
"should link using a valid id"
do
gfm
(
actual
).
should
match
(
expected
)
end
it
"should link with adjacent text"
do
# Wrap the reference in parenthesis
gfm
(
actual
.
gsub
(
reference
,
"(
#{
reference
}
)"
)).
should
match
(
expected
)
# Append some text to the end of the reference
gfm
(
actual
.
gsub
(
reference
,
"
#{
reference
}
, right?"
)).
should
match
(
expected
)
end
it
"should keep whitespace intact"
do
actual
=
"Referenced
#{
reference
}
already."
expected
=
/Referenced <a.+>[^\s]+<\/a> already/
gfm
(
actual
).
should
match
(
expected
)
end
it
"should not link with an invalid id"
do
# Modify the reference string so it's still parsed, but is invalid
invalid_reference
=
actual
.
gsub
(
/(\d+)$/
,
"r45"
)
gfm
(
invalid_reference
).
should
==
invalid_reference
end
it
"should include a title attribute"
do
title
=
"Issue in Redmine tracker"
gfm
(
actual
).
should
match
(
/title="
#{
title
}
"/
)
end
it
"should include standard gfm classes"
do
gfm
(
actual
).
should
match
(
/class="\s?gfm gfm-issue\s?"/
)
end
end
describe
"referencing a merge request"
do
let
(
:object
)
{
merge_request
}
let
(
:reference
)
{
"!
#{
merge_request
.
iid
}
"
}
...
...
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