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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
bb494203
Commit
bb494203
authored
Oct 19, 2013
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cover the simple_sanitize helper
parent
898e2acd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+1
-1
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+17
-0
No files found.
app/helpers/application_helper.rb
View file @
bb494203
...
...
@@ -192,7 +192,7 @@ module ApplicationHelper
alt:
"Sign in with
#{
provider
.
to_s
.
titleize
}
"
)
end
def
simple_sanitize
str
def
simple_sanitize
(
str
)
sanitize
(
str
,
tags:
%w(a span)
)
end
...
...
spec/helpers/application_helper_spec.rb
View file @
bb494203
...
...
@@ -123,4 +123,21 @@ describe ApplicationHelper do
end
end
describe
"simple_sanitize"
do
let
(
:a_tag
)
{
'<a href="#">Foo</a>'
}
it
"allows the a tag"
do
simple_sanitize
(
a_tag
).
should
==
a_tag
end
it
"allows the span tag"
do
input
=
'<span class="foo">Bar</span>'
simple_sanitize
(
input
).
should
==
input
end
it
"disallows other tags"
do
input
=
"<strike><b>
#{
a_tag
}
</b></strike>"
simple_sanitize
(
input
).
should
==
a_tag
end
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