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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
3b80cf52
Commit
3b80cf52
authored
May 02, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use to_reference in Mentionable shared examples
parent
8773f339
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
18 deletions
+14
-18
spec/support/mentionable_shared_examples.rb
spec/support/mentionable_shared_examples.rb
+14
-18
No files found.
spec/support/mentionable_shared_examples.rb
View file @
3b80cf52
...
...
@@ -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 @@ shared_examples 'an editable mentionable' do
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