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
6f9428b1
Commit
6f9428b1
authored
Aug 06, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix GFM helper to raise an exception when @project is not set
parent
90c2cd1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+1
-0
spec/helpers/gitlab_flavored_markdown_spec.rb
spec/helpers/gitlab_flavored_markdown_spec.rb
+6
-0
No files found.
app/helpers/application_helper.rb
View file @
6f9428b1
...
@@ -44,6 +44,7 @@ module ApplicationHelper
...
@@ -44,6 +44,7 @@ module ApplicationHelper
def
gfm
(
text
,
html_options
=
{})
def
gfm
(
text
,
html_options
=
{})
return
text
if
text
.
nil?
return
text
if
text
.
nil?
raise
"@project is not set"
if
@project
.
nil?
# Extract pre blocks
# Extract pre blocks
# from http://github.github.com/github-flavored-markdown/
# from http://github.github.com/github-flavored-markdown/
...
...
spec/helpers/gitlab_flavored_markdown_spec.rb
View file @
6f9428b1
...
@@ -10,6 +10,12 @@ describe ApplicationHelper do
...
@@ -10,6 +10,12 @@ describe ApplicationHelper do
end
end
describe
"#gfm"
do
describe
"#gfm"
do
it
"should raiase an error if @project is not set"
do
@project
=
nil
expect
{
gfm
(
"foo"
)
}.
to
raise_error
end
describe
"referencing a commit"
do
describe
"referencing a commit"
do
it
"should link using a full id"
do
it
"should link using a full id"
do
gfm
(
"Reverts changes from
#{
@commit
.
id
}
"
).
should
==
"Reverts changes from
#{
link_to
@commit
.
id
,
project_commit_path
(
@project
,
:id
=>
@commit
.
id
),
:title
=>
"Commit:
#{
@commit
.
author_name
}
-
#{
@commit
.
title
}
"
,
:class
=>
"gfm gfm-commit "
}
"
gfm
(
"Reverts changes from
#{
@commit
.
id
}
"
).
should
==
"Reverts changes from
#{
link_to
@commit
.
id
,
project_commit_path
(
@project
,
:id
=>
@commit
.
id
),
:title
=>
"Commit:
#{
@commit
.
author_name
}
-
#{
@commit
.
title
}
"
,
:class
=>
"gfm gfm-commit "
}
"
...
...
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