Sha256: b9a8b8719440cd3eeb33c3c576cd3e354605d26af2f1ce444f32039f54243f38

Contents?: true

Size: 642 Bytes

Versions: 3

Compression:

Stored size: 642 Bytes

Contents

require 'test_helper'
require 'review/htmlutils'

class HTMLUtilsTest < Test::Unit::TestCase
  include ReVIEW::HTMLUtils

  def test_escape_html
    assert_equal '&lt;', escape_html('<')
    assert_equal '&lt;&lt;', escape_html('<<')
    assert_equal '_&lt;_&lt;_', escape_html('_<_<_')
  end

  def test_escape_html_ex
    keys = ESC.keys
    ESC['.'] = 'X'
    ESC.each_pair do |ch, ref|
      if keys.include?(ch)
        assert_equal ref, escape_html(ch)
      else
        assert_equal ch, escape_html(ch)
      end
    end
  end

  def test_strip_html
    assert_equal 'thisistest.', strip_html('<h3>this<b>is</b>test</h3>.')
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
review-1.2.0 test/test_htmlutils.rb
review-1.1.0 test/test_htmlutils.rb
tmtms-review-1.0.0 test/test_htmlutils.rb