Sha256: 869cce123b73828d7b080ea641748cf3298a88d7fa3786991e96a96bb35b572c
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
require 'test_helper' # Test suite for Sanitize::Rails::Engine class SanitizeRailsEngineTest < Minitest::Test def setup @engine = Sanitize::Rails::Engine end def test_respond_to_configure assert_respond_to @engine, :configure end def test_respond_to_cleaner assert_respond_to @engine, :cleaner end def test_cleaner_returns_instance_of_sanitize assert_kind_of Sanitize, @engine.cleaner end def test_respond_to_clean_bang assert_respond_to @engine, :clean! end def test_clean_bang_modifies_string_in_place string = %Q|<script>alert("hello world")</script>| @engine.clean! string assert_equal string, %q|alert("hello world")| end def test_respond_to_clean assert_respond_to @engine, :clean end def test_clean_does_not_modify_string_in_place string = %Q|<script>alert("hello world")</script>| new_string = @engine.clean string assert_equal string, %Q|<script>alert("hello world")</script>| assert_equal new_string, 'alert("hello world")' end def test_clean_returns_safe_buffers string = %Q|<script>alert("hello world")</script>| assert_instance_of String, string new_string = @engine.clean string assert_instance_of ::ActiveSupport::SafeBuffer, new_string end def test_clean_not_producing_malicious_html_entities string = %Q|<script>hello & world</script>| @engine.clean! string assert_equal string, "<script>hello & world</script>" end def test_clean_making_html_entities string = %Q|<script>hello & world</script>| @engine.clean! string assert_equal string, "hello & world" end def test_clean_returns_blank_string_for_nil_input assert_equal '', @engine.clean(nil) end def test_clean_bang_returns_blank_string_for_nil_input assert_equal '', @engine.clean!(nil) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sanitize-rails-1.1.1 | test/sanitize_rails_engine_test.rb |
sanitize-rails-1.1.0 | test/sanitize_rails_engine_test.rb |