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
d6985358
Commit
d6985358
authored
Jun 13, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for issue sentence generation
parent
2af8ace1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
app/helpers/merge_requests_helper.rb
app/helpers/merge_requests_helper.rb
+4
-0
app/views/projects/merge_requests/show/_state_widget.html.haml
...iews/projects/merge_requests/show/_state_widget.html.haml
+1
-1
spec/helpers/merge_requests_helper.rb
spec/helpers/merge_requests_helper.rb
+12
-0
No files found.
app/helpers/merge_requests_helper.rb
View file @
d6985358
...
...
@@ -42,4 +42,8 @@ module MergeRequestsHelper
"Branches:
#{
@merge_request
.
source_branch
}
#{
separator
}
#{
@merge_request
.
target_branch
}
"
end
end
def
issues_sentence
(
issues
)
issues
.
map
{
|
i
|
"#
#{
i
.
iid
}
"
}.
to_sentence
end
end
app/views/projects/merge_requests/show/_state_widget.html.haml
View file @
d6985358
...
...
@@ -37,5 +37,5 @@
%i
.icon-ok
Accepting this merge request will close
#{
@closes_issues
.
size
==
1
?
'issue'
:
'issues'
}
=
succeed
'.'
do
!=
gfm
(
@closes_issues
.
map
{
|
i
|
"#
#{
i
.
iid
}
"
}.
to_sentence
)
!=
gfm
(
issues_sentence
(
@closes_issues
)
)
spec/helpers/merge_requests_helper.rb
0 → 100644
View file @
d6985358
require
'spec_helper'
describe
MergeRequestsHelper
do
describe
:issues_sentence
do
subject
{
issues_sentence
(
issues
)
}
let
(
:issues
)
do
[
build
(
:issue
,
iid:
1
),
build
(
:issue
,
iid:
2
),
build
(
:issue
,
iid:
3
)]
end
it
{
should
eq
(
'#1, #2, and #3'
)
}
end
end
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