Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
e4dcbaa87a94
Commit
3b80cf52
authored
May 02, 2015
by
Robert Speicher
Browse files
Use to_reference in Mentionable shared examples
parent
867e133b9c00
Changes
1
Hide whitespace changes
Inline
Side-by-side
spec/support/mentionable_shared_examples.rb
View file @
e4dcbaa8
...
...
@@ -10,12 +10,12 @@ def common_mentionable_setup
let
(
:mentioned_issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:mentioned_mr
)
{
create
(
:merge_request
,
:simple
,
source_project:
project
)
}
let
(
:mentioned_commit
)
{
project
.
repository
.
commit
}
let
(
:mentioned_commit
)
{
project
.
commit
}
let
(
:ext_proj
)
{
create
(
:project
,
:public
)
}
let
(
:ext_issue
)
{
create
(
:issue
,
project:
ext_proj
)
}
let
(
:ext_mr
)
{
create
(
:merge_request
,
:simple
,
source_project:
ext_proj
)
}
let
(
:ext_commit
)
{
ext_proj
.
repository
.
commit
}
let
(
:ext_commit
)
{
ext_proj
.
commit
}
# Override to add known commits to the repository stub.
let
(
:extra_commits
)
{
[]
}
...
...
@@ -23,21 +23,19 @@ def common_mentionable_setup
# A string that mentions each of the +mentioned_.*+ objects above. Mentionables should add a self-reference
# to this string and place it in their +mentionable_text+.
let
(
:ref_string
)
do
cross
=
ext_proj
.
path_with_namespace
<<-
MSG
.
strip_heredoc
These references are new:
Issue:
#
#{
mentioned_issue
.
iid
}
Merge:
!
#{
mentioned_mr
.
iid
}
Commit:
#{
mentioned_commit
.
id
}
Issue:
#{
mentioned_issue
.
to_reference
}
Merge:
#{
mentioned_mr
.
to_reference
}
Commit:
#{
mentioned_commit
.
to_reference
}
This reference is a repeat and should only be mentioned once:
Repeat:
#
#{
mentioned_issue
.
iid
}
Repeat:
#{
mentioned_issue
.
to_reference
}
These references are cross-referenced:
Issue:
#{
cross
}
#
#{
ext_issue
.
iid
}
Merge:
#{
cross
}
!
#{
ext_mr
.
iid
}
Commit:
#{
cross
}
@
#{
ext_commit
.
short_id
}
Issue:
#{
ext_issue
.
to_reference
(
project
)
}
Merge:
#{
ext_mr
.
to_reference
(
project
)
}
Commit:
#{
ext_commit
.
to_reference
(
project
)
}
This is a self-reference and should not be mentioned at all:
Self:
#{
backref_text
}
...
...
@@ -109,19 +107,17 @@ def common_mentionable_setup
it
'creates new cross-reference notes when the mentionable text is edited'
do
subject
.
save
cross
=
ext_proj
.
path_with_namespace
new_text
=
<<-
MSG
These references already existed:
Issue:
#
#{
mentioned_issue
.
iid
}
Commit:
#{
mentioned_commit
.
id
}
Issue:
#{
mentioned_issue
.
to_reference
}
Commit:
#{
mentioned_commit
.
to_reference
}
This cross-project reference already existed:
Issue:
#{
cross
}
#
#{
ext_issue
.
iid
}
Issue:
#{
ext_issue
.
to_reference
(
project
)
}
These two references are introduced in an edit:
Issue:
#
#{
new_issues
[
0
].
iid
}
Cross:
#{
cross
}
#
#{
new_issues
[
1
].
iid
}
Issue:
#{
new_issues
[
0
].
to_reference
}
Cross:
#{
new_issues
[
1
].
to_reference
(
project
)
}
MSG
# These three objects were already referenced, and should not receive new
...
...
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