Commit bb494203d263104e9f2ac13d18c438798f7a99f8
1 parent
898e2acd
Exists in
master
and in
4 other branches
Cover the simple_sanitize helper
Showing
2 changed files
with
18 additions
and
1 deletions
Show diff stats
app/helpers/application_helper.rb
spec/helpers/application_helper_spec.rb
... | ... | @@ -123,4 +123,21 @@ describe ApplicationHelper do |
123 | 123 | end |
124 | 124 | end |
125 | 125 | |
126 | + describe "simple_sanitize" do | |
127 | + let(:a_tag) { '<a href="#">Foo</a>' } | |
128 | + | |
129 | + it "allows the a tag" do | |
130 | + simple_sanitize(a_tag).should == a_tag | |
131 | + end | |
132 | + | |
133 | + it "allows the span tag" do | |
134 | + input = '<span class="foo">Bar</span>' | |
135 | + simple_sanitize(input).should == input | |
136 | + end | |
137 | + | |
138 | + it "disallows other tags" do | |
139 | + input = "<strike><b>#{a_tag}</b></strike>" | |
140 | + simple_sanitize(input).should == a_tag | |
141 | + end | |
142 | + end | |
126 | 143 | end | ... | ... |