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
0a60b19b
Commit
0a60b19b
authored
Aug 02, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the commit_msg_with_link_to_issues helper and specs
parent
24ec186a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
85 deletions
+0
-85
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+0
-18
spec/helpers/commit_helper_spec.rb
spec/helpers/commit_helper_spec.rb
+0
-67
No files found.
app/helpers/commits_helper.rb
View file @
0a60b19b
module
CommitsHelper
def
commit_msg_with_link_to_issues
(
project
,
message
)
return
''
unless
message
out
=
''
message
.
split
(
/(#[0-9]+)/m
).
each
do
|
m
|
if
m
=~
/(#([0-9]+))/m
begin
issue
=
project
.
issues
.
find
(
$2
)
out
+=
link_to
(
$1
,
project_issue_path
(
project
,
$2
))
rescue
out
+=
$1
end
else
out
+=
m
end
end
preserve
out
end
def
identification_type
(
line
)
if
line
[
0
]
==
"+"
"new"
...
...
spec/helpers/commit_helper_spec.rb
deleted
100644 → 0
View file @
24ec186a
require
"spec_helper"
include
Haml
::
Helpers
describe
CommitsHelper
do
before
do
@project
=
Factory
:project
@other_project
=
Factory
:project
,
:path
=>
"OtherPath"
,
:code
=>
"OtherCode"
@fake_user
=
Factory
:user
@valid_issue
=
Factory
:issue
,
:assignee
=>
@fake_user
,
:author
=>
@fake_user
,
:project
=>
@project
@invalid_issue
=
Factory
:issue
,
:assignee
=>
@fake_user
,
:author
=>
@fake_user
,
:project
=>
@other_project
end
it
"should provides return message untouched if no issue number present"
do
message
=
"Dummy message without issue number"
commit_msg_with_link_to_issues
(
@project
,
message
).
should
eql
message
end
it
"should returns message handled by preserve"
do
message
=
"My brand new
Commit on multiple
lines !"
#\n are converted to 
 as specified in preserve_rspec
expected
=
"My brand new
 Commit on multiple
 lines !"
commit_msg_with_link_to_issues
(
@project
,
message
).
should
eql
expected
end
it
"should returns empty string if message undefined"
do
commit_msg_with_link_to_issues
(
@project
,
nil
).
should
eql
''
end
it
"should returns link_to issue for one valid issue in message"
do
issue_id
=
@valid_issue
.
id
message
=
"One commit message #
#{
issue_id
}
"
expected
=
"One commit message <a href=
\"
/
#{
@project
.
code
}
/issues/
#{
issue_id
}
\"
>#
#{
issue_id
}
</a>"
commit_msg_with_link_to_issues
(
@project
,
message
).
should
eql
expected
end
it
"should returns message untouched for one invalid issue in message"
do
issue_id
=
@invalid_issue
.
id
message
=
"One commit message #
#{
issue_id
}
"
commit_msg_with_link_to_issues
(
@project
,
message
).
should
eql
message
end
it
"should handle multiple issue references in commit message"
do
issue_id
=
@valid_issue
.
id
invalid_issue_id
=
@invalid_issue
.
id
message
=
"One big commit message with a valid issue #
#{
issue_id
}
and an invalid one #
#{
invalid_issue_id
}
.
We reference valid #
#{
issue_id
}
multiple times (#
#{
issue_id
}
) as the invalid #
#{
invalid_issue_id
}
is also
referenced another time (#
#{
invalid_issue_id
}
)"
expected
=
"One big commit message with a valid issue <a href=
\"
/
#{
@project
.
code
}
/issues/
#{
issue_id
}
\"
>#
#{
issue_id
}
</a>"
+
" and an invalid one #
#{
invalid_issue_id
}
.
 "
+
"We reference valid <a href=
\"
/
#{
@project
.
code
}
/issues/
#{
issue_id
}
\"
>#
#{
issue_id
}
</a> multiple times "
+
"(<a href=
\"
/
#{
@project
.
code
}
/issues/
#{
issue_id
}
\"
>#
#{
issue_id
}
</a>) "
+
"as the invalid #
#{
invalid_issue_id
}
is also
 referenced another time (#
#{
invalid_issue_id
}
)"
commit_msg_with_link_to_issues
(
@project
,
message
).
should
eql
expected
end
end
\ No newline at end of file
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