Sha256: b91eb4a4b17fe90faa3a73c80bda9e055e730ca3c45dedbe4556190850ffe346
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
require 'test_helper' require 'action_view' require 'sanitize' require 'sanitize/rails' # 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_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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sanitize-rails-0.8.1 | test/sanitize_rails_engine_test.rb |