Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added test coverage for complaint in issue #20. these tests pass for …

…libxml 2.7.5.
  • Loading branch information...
commit a9a93e7abefb5d0a704b6fe2d813fa202b639298 1 parent c45ecf4
@flavorjones flavorjones authored
Showing with 27 additions and 0 deletions.
  1. +27 −0 test/unit/test_xss_foliate.rb
View
27 test/unit/test_xss_foliate.rb
@@ -184,5 +184,32 @@ def new_post(overrides={})
assert_equal "<script>alert('evil')</script>", post.plain_text
end
end
+
+ context "these tests should pass for libxml 2.7.5 and later" do
+ should "not scrub double quotes into html entities" do
+ answer = new_post(:plain_text => "\"something\"")
+ answer.valid?
+ assert_equal "\"something\"", answer.plain_text
+ end
+
+ should "not scrub ampersands into html entities" do
+ answer = new_post(:plain_text => "& Something")
+ answer.valid?
+ assert_equal "& Something", answer.plain_text
+ end
+
+ should "not scrub \\r html entities" do
+ answer = new_post(:plain_text => "Another \r Something")
+ answer.valid?
+ assert_equal "Another \r Something", answer.plain_text
+ end
+
+ should "not scrub \\n html entities" do
+ answer = new_post(:plain_text => "Another \n Something")
+ answer.valid?
+ assert_equal "Another \n Something", answer.plain_text
+ end
+ end
end
end
+
Please sign in to comment.
Something went wrong with that request. Please try again.