Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require File.dirname(__FILE__) + '/../test_helper'
- class StathamSanitizerTest < ActiveSupport::TestCase
- context "A StathamSanitizer" do
- setup do
- @sanitizer = HTML::StathamSanitizer.new
- end
- should "escape tags that are neither allowed nor banned" do
- assert_equal "<font>Hello</font>", @sanitizer.sanitize("<font>Hello</font>")
- end
- should "escape tags that are allowed but unclosed" do
- assert_equal "<p>Hello", @sanitizer.sanitize("<p>Hello")
- end
- should "escape tags that are closed without ever being opened" do
- assert_equal "Hello</p>", @sanitizer.sanitize("Hello</p>")
- end
- should "include tags that are allowed and self-closing" do
- assert_equal "Hello<br />", @sanitizer.sanitize("Hello<br />")
- end
- should "escape comments" do
- assert_equal "<!-- comment", @sanitizer.sanitize("<!-- comment")
- end
- end
- end
Add Comment
Please, Sign In to add comment