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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
5a9c5520
Commit
5a9c5520
authored
May 21, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make use of to_reference in more specs
parent
68f74aa8
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
76 additions
and
73 deletions
+76
-73
lib/gitlab/closing_issue_extractor.rb
lib/gitlab/closing_issue_extractor.rb
+1
-1
lib/gitlab/markdown/external_issue_reference_filter.rb
lib/gitlab/markdown/external_issue_reference_filter.rb
+1
-1
lib/gitlab/markdown/issue_reference_filter.rb
lib/gitlab/markdown/issue_reference_filter.rb
+1
-1
lib/gitlab/markdown/merge_request_reference_filter.rb
lib/gitlab/markdown/merge_request_reference_filter.rb
+1
-1
lib/gitlab/markdown/snippet_reference_filter.rb
lib/gitlab/markdown/snippet_reference_filter.rb
+1
-1
lib/gitlab/markdown/user_reference_filter.rb
lib/gitlab/markdown/user_reference_filter.rb
+6
-3
spec/features/gitlab_flavored_markdown_spec.rb
spec/features/gitlab_flavored_markdown_spec.rb
+17
-17
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+5
-5
spec/lib/gitlab/closing_issue_extractor_spec.rb
spec/lib/gitlab/closing_issue_extractor_spec.rb
+35
-35
spec/lib/gitlab/reference_extractor_spec.rb
spec/lib/gitlab/reference_extractor_spec.rb
+2
-2
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+1
-1
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+5
-5
No files found.
lib/gitlab/closing_issue_extractor.rb
View file @
5a9c5520
...
...
@@ -8,7 +8,7 @@ module Gitlab
def
closed_by_message
(
message
)
return
[]
if
message
.
nil?
closing_statements
=
message
.
scan
(
ISSUE_CLOSING_REGEX
).
map
{
|
ref
|
ref
[
0
]
}.
join
(
" "
)
...
...
lib/gitlab/markdown/external_issue_reference_filter.rb
View file @
5a9c5520
...
...
@@ -48,7 +48,7 @@ module Gitlab
%(<a href="#{url}"
title="#{title}"
class="#{klass}">#{
issue
}</a>)
class="#{klass}">#{
match
}</a>)
end
end
...
...
lib/gitlab/markdown/issue_reference_filter.rb
View file @
5a9c5520
...
...
@@ -52,7 +52,7 @@ module Gitlab
%(<a href="#{url}"
title="#{title}"
class="#{klass}">#{
project_ref}##{id
}</a>)
class="#{klass}">#{
match
}</a>)
else
match
end
...
...
lib/gitlab/markdown/merge_request_reference_filter.rb
View file @
5a9c5520
...
...
@@ -52,7 +52,7 @@ module Gitlab
%(<a href="#{url}"
title="#{title}"
class="#{klass}">#{
project_ref}!#{id
}</a>)
class="#{klass}">#{
match
}</a>)
else
match
end
...
...
lib/gitlab/markdown/snippet_reference_filter.rb
View file @
5a9c5520
...
...
@@ -52,7 +52,7 @@ module Gitlab
%(<a href="#{url}"
title="#{title}"
class="#{klass}">#{
project_ref}$#{id
}</a>)
class="#{klass}">#{
match
}</a>)
else
match
end
...
...
lib/gitlab/markdown/user_reference_filter.rb
View file @
5a9c5520
...
...
@@ -65,7 +65,8 @@ module Gitlab
url
=
urls
.
namespace_project_url
(
project
.
namespace
,
project
,
only_path:
context
[
:only_path
])
%(<a href="#{url}" class="#{link_class}">@all</a>)
text
=
User
.
reference_prefix
+
'all'
%(<a href="#{url}" class="#{link_class}">#{text}</a>)
end
def
link_to_namespace
(
namespace
)
...
...
@@ -83,7 +84,8 @@ module Gitlab
url
=
urls
.
group_url
(
group
,
only_path:
context
[
:only_path
])
%(<a href="#{url}" class="#{link_class}">@#{group}</a>)
text
=
Group
.
reference_prefix
+
group
%(<a href="#{url}" class="#{link_class}">#{text}</a>)
end
def
link_to_user
(
user
,
namespace
)
...
...
@@ -91,7 +93,8 @@ module Gitlab
url
=
urls
.
user_url
(
user
,
only_path:
context
[
:only_path
])
%(<a href="#{url}" class="#{link_class}">@#{user}</a>)
text
=
User
.
reference_prefix
+
user
%(<a href="#{url}" class="#{link_class}">#{text}</a>)
end
def
user_can_reference_group?
(
group
)
...
...
spec/features/gitlab_flavored_markdown_spec.rb
View file @
5a9c5520
...
...
@@ -11,7 +11,7 @@ describe "GitLab Flavored Markdown", feature: true do
end
before
do
Commit
.
any_instance
.
stub
(
title:
"fix #
#{
issue
.
iid
}
\n\n
ask @
#{
fred
.
usernam
e
}
for details"
)
Commit
.
any_instance
.
stub
(
title:
"fix
#
{
issue
.
to_reference
}
\n\n
ask
#{
fred
.
to_referenc
e
}
for details"
)
end
let
(
:commit
)
{
project
.
commit
}
...
...
@@ -25,25 +25,25 @@ describe "GitLab Flavored Markdown", feature: true do
it
"should render title in commits#index"
do
visit
namespace_project_commits_path
(
project
.
namespace
,
project
,
'master'
,
limit:
1
)
expect
(
page
).
to
have_link
(
"#
#{
issue
.
iid
}
"
)
expect
(
page
).
to
have_link
(
issue
.
to_reference
)
end
it
"should render title in commits#show"
do
visit
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
)
expect
(
page
).
to
have_link
(
"#
#{
issue
.
iid
}
"
)
expect
(
page
).
to
have_link
(
issue
.
to_reference
)
end
it
"should render description in commits#show"
do
visit
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
)
expect
(
page
).
to
have_link
(
"@
#{
fred
.
username
}
"
)
expect
(
page
).
to
have_link
(
fred
.
to_reference
)
end
it
"should render title in repositories#branches"
do
visit
namespace_project_branches_path
(
project
.
namespace
,
project
)
expect
(
page
).
to
have_link
(
"#
#{
issue
.
iid
}
"
)
expect
(
page
).
to
have_link
(
issue
.
to_reference
)
end
end
...
...
@@ -57,20 +57,20 @@ describe "GitLab Flavored Markdown", feature: true do
author:
@user
,
assignee:
@user
,
project:
project
,
title:
"fix #
#{
@other_issue
.
iid
}
"
,
description:
"ask
@
#{
fred
.
usernam
e
}
for details"
)
title:
"fix
#
{
@other_issue
.
to_reference
}
"
,
description:
"ask
#{
fred
.
to_referenc
e
}
for details"
)
end
it
"should render subject in issues#index"
do
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
expect
(
page
).
to
have_link
(
"#
#{
@other_issue
.
iid
}
"
)
expect
(
page
).
to
have_link
(
@other_issue
.
to_reference
)
end
it
"should render subject in issues#show"
do
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
@issue
)
expect
(
page
).
to
have_link
(
"#
#{
@other_issue
.
iid
}
"
)
expect
(
page
).
to
have_link
(
@other_issue
.
to_reference
)
end
it
"should render details in issues#show"
do
...
...
@@ -83,19 +83,19 @@ describe "GitLab Flavored Markdown", feature: true do
describe
"for merge requests"
do
before
do
@merge_request
=
create
(
:merge_request
,
source_project:
project
,
target_project:
project
,
title:
"fix #
#{
issue
.
iid
}
"
)
@merge_request
=
create
(
:merge_request
,
source_project:
project
,
target_project:
project
,
title:
"fix
#
{
issue
.
to_reference
}
"
)
end
it
"should render title in merge_requests#index"
do
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
)
expect
(
page
).
to
have_link
(
"#
#{
issue
.
iid
}
"
)
expect
(
page
).
to
have_link
(
issue
.
to_reference
)
end
it
"should render title in merge_requests#show"
do
visit
namespace_project_merge_request_path
(
project
.
namespace
,
project
,
@merge_request
)
expect
(
page
).
to
have_link
(
"#
#{
issue
.
iid
}
"
)
expect
(
page
).
to
have_link
(
issue
.
to_reference
)
end
end
...
...
@@ -104,26 +104,26 @@ describe "GitLab Flavored Markdown", feature: true do
before
do
@milestone
=
create
(
:milestone
,
project:
project
,
title:
"fix #
#{
issue
.
iid
}
"
,
description:
"ask
@
#{
fred
.
usernam
e
}
for details"
)
title:
"fix
#
{
issue
.
to_reference
}
"
,
description:
"ask
#{
fred
.
to_referenc
e
}
for details"
)
end
it
"should render title in milestones#index"
do
visit
namespace_project_milestones_path
(
project
.
namespace
,
project
)
expect
(
page
).
to
have_link
(
"#
#{
issue
.
iid
}
"
)
expect
(
page
).
to
have_link
(
issue
.
to_reference
)
end
it
"should render title in milestones#show"
do
visit
namespace_project_milestone_path
(
project
.
namespace
,
project
,
@milestone
)
expect
(
page
).
to
have_link
(
"#
#{
issue
.
iid
}
"
)
expect
(
page
).
to
have_link
(
issue
.
to_reference
)
end
it
"should render description in milestones#show"
do
visit
namespace_project_milestone_path
(
project
.
namespace
,
project
,
@milestone
)
expect
(
page
).
to
have_link
(
"@
#{
fred
.
username
}
"
)
expect
(
page
).
to
have_link
(
fred
.
to_reference
)
end
end
end
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
5a9c5520
...
...
@@ -26,7 +26,7 @@ describe GitlabMarkdownHelper do
end
describe
"referencing multiple objects"
do
let
(
:actual
)
{
"
!
#{
merge_request
.
iid
}
->
#{
commit
.
id
}
-> #
#{
issue
.
iid
}
"
}
let
(
:actual
)
{
"
#{
merge_request
.
to_reference
}
->
#{
commit
.
to_reference
}
->
#{
issue
.
to_reference
}
"
}
it
"should link to the merge request"
do
expected
=
namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
)
...
...
@@ -50,7 +50,7 @@ describe GitlabMarkdownHelper do
let
(
:issues
)
{
create_list
(
:issue
,
2
,
project:
project
)
}
it
'should handle references nested in links with all the text'
do
actual
=
link_to_gfm
(
"This should finally fix #
#{
issues
[
0
].
iid
}
and #
#{
issues
[
1
].
iid
}
for real"
,
commit_path
)
actual
=
link_to_gfm
(
"This should finally fix
#
{
issues
[
0
].
to_reference
}
and
#{
issues
[
1
].
to_reference
}
for real"
,
commit_path
)
doc
=
Nokogiri
::
HTML
.
parse
(
actual
)
# Make sure we didn't create invalid markup
...
...
@@ -63,7 +63,7 @@ describe GitlabMarkdownHelper do
# First issue link
expect
(
doc
.
css
(
'a'
)[
1
].
attr
(
'href'
)).
to
eq
namespace_project_issue_path
(
project
.
namespace
,
project
,
issues
[
0
])
expect
(
doc
.
css
(
'a'
)[
1
].
text
).
to
eq
"#
#{
issues
[
0
].
iid
}
"
expect
(
doc
.
css
(
'a'
)[
1
].
text
).
to
eq
issues
[
0
].
to_reference
# Internal commit link
expect
(
doc
.
css
(
'a'
)[
2
].
attr
(
'href'
)).
to
eq
commit_path
...
...
@@ -72,7 +72,7 @@ describe GitlabMarkdownHelper do
# Second issue link
expect
(
doc
.
css
(
'a'
)[
3
].
attr
(
'href'
)).
to
eq
namespace_project_issue_path
(
project
.
namespace
,
project
,
issues
[
1
])
expect
(
doc
.
css
(
'a'
)[
3
].
text
).
to
eq
"#
#{
issues
[
1
].
iid
}
"
expect
(
doc
.
css
(
'a'
)[
3
].
text
).
to
eq
issues
[
1
].
to_reference
# Trailing commit link
expect
(
doc
.
css
(
'a'
)[
4
].
attr
(
'href'
)).
to
eq
commit_path
...
...
@@ -90,7 +90,7 @@ describe GitlabMarkdownHelper do
end
it
"escapes HTML passed in as the body"
do
actual
=
"This is a <h1>test</h1> - see #
#{
issues
[
0
].
iid
}
"
actual
=
"This is a <h1>test</h1> - see
#
{
issues
[
0
].
to_reference
}
"
expect
(
link_to_gfm
(
actual
,
commit_path
)).
to
match
(
'<h1>test</h1>'
)
end
...
...
spec/lib/gitlab/closing_issue_extractor_spec.rb
View file @
5a9c5520
require
'spec_helper'
describe
Gitlab
::
ClosingIssueExtractor
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:
iid1
)
{
issue
.
iid
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:
reference
)
{
issue
.
to_reference
}
subject
{
described_class
.
new
(
project
,
project
.
creator
)
}
describe
"#closed_by_message"
do
context
'with a single reference'
do
it
do
message
=
"Awesome commit (Closes #
#{
iid1
}
)"
message
=
"Awesome commit (Closes
#
{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Awesome commit (closes #
#{
iid1
}
)"
message
=
"Awesome commit (closes
#
{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Closed #
#{
iid1
}
"
message
=
"Closed
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"closed #
#{
iid1
}
"
message
=
"closed
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Closing #
#{
iid1
}
"
message
=
"Closing
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"closing #
#{
iid1
}
"
message
=
"closing
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Close #
#{
iid1
}
"
message
=
"Close
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"close #
#{
iid1
}
"
message
=
"close
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Awesome commit (Fixes #
#{
iid1
}
)"
message
=
"Awesome commit (Fixes
#
{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Awesome commit (fixes #
#{
iid1
}
)"
message
=
"Awesome commit (fixes
#
{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Fixed #
#{
iid1
}
"
message
=
"Fixed
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"fixed #
#{
iid1
}
"
message
=
"fixed
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Fixing #
#{
iid1
}
"
message
=
"Fixing
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"fixing #
#{
iid1
}
"
message
=
"fixing
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Fix #
#{
iid1
}
"
message
=
"Fix
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"fix #
#{
iid1
}
"
message
=
"fix
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Awesome commit (Resolves #
#{
iid1
}
)"
message
=
"Awesome commit (Resolves
#
{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Awesome commit (resolves #
#{
iid1
}
)"
message
=
"Awesome commit (resolves
#
{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Resolved #
#{
iid1
}
"
message
=
"Resolved
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"resolved #
#{
iid1
}
"
message
=
"resolved
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Resolving #
#{
iid1
}
"
message
=
"Resolving
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"resolving #
#{
iid1
}
"
message
=
"resolving
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"Resolve #
#{
iid1
}
"
message
=
"Resolve
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
message
=
"resolve #
#{
iid1
}
"
message
=
"resolve
#
{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
...
...
@@ -133,40 +133,40 @@ describe Gitlab::ClosingIssueExtractor do
context
'with multiple references'
do
let
(
:other_issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:third_issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:
iid2
)
{
other_issue
.
iid
}
let
(
:
iid3
)
{
third_issue
.
iid
}
let
(
:
reference2
)
{
other_issue
.
to_reference
}
let
(
:
reference3
)
{
third_issue
.
to_reference
}
it
'fetches issues in single line message'
do
message
=
"Closes #
#{
iid1
}
and fix #
#{
iid
2
}
"
message
=
"Closes
#
{
reference
}
and fix #
#{
reference
2
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
,
other_issue
])
end
it
'fetches comma-separated issues references in single line message'
do
message
=
"Closes #
#{
iid1
}
, closes #
#{
iid
2
}
"
message
=
"Closes
#
{
reference
}
, closes #
#{
reference
2
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
,
other_issue
])
end
it
'fetches comma-separated issues numbers in single line message'
do
message
=
"Closes #
#{
iid1
}
, #
#{
iid2
}
and #
#{
iid
3
}
"
message
=
"Closes
#
{
reference
}
, #
#{
reference2
}
and #
#{
reference
3
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
,
other_issue
,
third_issue
])
end
it
'fetches issues in multi-line message'
do
message
=
"Awesome commit (closes #
#{
iid1
}
)
\n
Also fixes #
#{
iid
2
}
"
message
=
"Awesome commit (closes
#
{
reference
}
)
\n
Also fixes #
#{
reference
2
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
,
other_issue
])
end
it
'fetches issues in hybrid message'
do
message
=
"Awesome commit (closes #
#{
iid1
}
)
\n
"
\
"Also fixing issues #
#{
iid2
}
, #
#{
iid
3
}
and #4"
message
=
"Awesome commit (closes
#
{
reference
}
)
\n
"
\
"Also fixing issues #
#{
reference2
}
, #
#{
reference
3
}
and #4"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
,
other_issue
,
third_issue
])
...
...
spec/lib/gitlab/reference_extractor_spec.rb
View file @
5a9c5520
...
...
@@ -20,7 +20,7 @@ describe Gitlab::ReferenceExtractor do
@i0
=
create
(
:issue
,
project:
project
)
@i1
=
create
(
:issue
,
project:
project
)
subject
.
analyze
(
"#
#{
@i0
.
iid
}
, #
#{
@i1
.
iid
}
, and #
999."
)
subject
.
analyze
(
"
#
{
@i0
.
to_reference
}
,
#{
@i1
.
to_reference
}
, and
#{
Issue
.
reference_prefix
}
999."
)
expect
(
subject
.
issues
).
to
eq
([
@i0
,
@i1
])
end
...
...
@@ -82,7 +82,7 @@ describe Gitlab::ReferenceExtractor do
end
it
'handles project issue references'
do
subject
.
analyze
(
"this refers issue
#{
other_project
.
path_with_namespace
}
#
#{
issue
.
iid
}
"
)
subject
.
analyze
(
"this refers issue
#{
issue
.
to_reference
(
project
)
}
"
)
extracted
=
subject
.
issues
expect
(
extracted
.
size
).
to
eq
(
1
)
expect
(
extracted
).
to
eq
([
issue
])
...
...
spec/models/merge_request_spec.rb
View file @
5a9c5520
...
...
@@ -129,7 +129,7 @@ describe MergeRequest do
it
'detects issues mentioned in the description'
do
issue2
=
create
(
:issue
,
project:
subject
.
project
)
subject
.
description
=
"Closes #
#{
issue2
.
iid
}
"
subject
.
description
=
"Closes
#
{
issue2
.
to_reference
}
"
subject
.
project
.
stub
(
default_branch:
subject
.
target_branch
)
expect
(
subject
.
closes_issues
).
to
include
(
issue2
)
...
...
spec/services/system_note_service_spec.rb
View file @
5a9c5520
...
...
@@ -238,13 +238,13 @@ describe SystemNoteService do
let
(
:mentioner
)
{
project2
.
repository
.
commit
}
it
'references the mentioning commit'
do
expect
(
subject
.
note
).
to
eq
"mentioned in commit
#{
project2
.
path_with_namespace
}
@
#{
mentioner
.
id
}
"
expect
(
subject
.
note
).
to
eq
"mentioned in commit
#{
mentioner
.
to_reference
(
project
)
}
"
end
end
context
'from non-Commit'
do
it
'references the mentioning object'
do
expect
(
subject
.
note
).
to
eq
"mentioned in issue
#{
project2
.
path_with_namespace
}
#
#{
mentioner
.
iid
}
"
expect
(
subject
.
note
).
to
eq
"mentioned in issue
#{
mentioner
.
to_reference
(
project
)
}
"
end
end
end
...
...
@@ -254,13 +254,13 @@ describe SystemNoteService do
let
(
:mentioner
)
{
project
.
repository
.
commit
}
it
'references the mentioning commit'
do
expect
(
subject
.
note
).
to
eq
"mentioned in commit
#{
mentioner
.
id
}
"
expect
(
subject
.
note
).
to
eq
"mentioned in commit
#{
mentioner
.
to_reference
}
"
end
end
context
'from non-Commit'
do
it
'references the mentioning object'
do
expect
(
subject
.
note
).
to
eq
"mentioned in issue #
#{
mentioner
.
iid
}
"
expect
(
subject
.
note
).
to
eq
"mentioned in issue
#
{
mentioner
.
to_reference
}
"
end
end
end
...
...
@@ -270,7 +270,7 @@ describe SystemNoteService do
describe
'.cross_reference?'
do
it
'is truthy when text begins with expected text'
do
expect
(
described_class
.
cross_reference?
(
'mentioned in
issue #1
'
)).
to
be_truthy
expect
(
described_class
.
cross_reference?
(
'mentioned in
something
'
)).
to
be_truthy
end
it
'is falsey when text does not begin with expected text'
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