Sha256: 05fa45c5041dbb55193f2d0cc4ccb4529fe2bd4d799089508b62b131938b61d4
Contents?: true
Size: 952 Bytes
Versions: 1
Compression:
Stored size: 952 Bytes
Contents
require File.expand_path('../../unit_test_helper', __FILE__) class SanitizeTest < Minitest::Test def test_trasform result = auto_html("<script>alert(0)</script>") { sanitize } assert_equal "", result end def test_trasform2 result = auto_html("<div>test</div>") { sanitize } assert_equal "<div>test</div>", result end def test_trasform3 result = auto_html("<div>test</div>") { sanitize :tags => %w(div) } assert_equal "<div>test</div>", result end def test_trasform4 result = auto_html("<div>test</div>") { sanitize :tags => %w(p) } assert_equal "test", result end def test_trasform5 result = auto_html("<a rel='nofollow'>test</div>") { sanitize :tags => %w(a), :attributes => %w(href)} assert_equal "<a>test", result # # from Rails doc: # # Please note that sanitizing user-provided text does not # guarantee that the resulting markup is valid. # end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
auto_html-whistlerbrk-2.0.0.pre | test/unit/filters/sanitize_test.rb |