Commit bb494203 authored by Robert Speicher's avatar Robert Speicher

Cover the simple_sanitize helper

parent 898e2acd
...@@ -192,7 +192,7 @@ module ApplicationHelper ...@@ -192,7 +192,7 @@ module ApplicationHelper
alt: "Sign in with #{provider.to_s.titleize}") alt: "Sign in with #{provider.to_s.titleize}")
end end
def simple_sanitize str def simple_sanitize(str)
sanitize(str, tags: %w(a span)) sanitize(str, tags: %w(a span))
end end
......
...@@ -123,4 +123,21 @@ describe ApplicationHelper do ...@@ -123,4 +123,21 @@ describe ApplicationHelper do
end end
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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment