Sha256: 3307e2c79af62bf111f8be3f5cfe6f1d050e8bd07dd77a6205d66e46da9d51a2

Contents?: true

Size: 699 Bytes

Versions: 8

Compression:

Stored size: 699 Bytes

Contents

# encoding: utf-8

class Nanoc3::Helpers::HTMLEscapeTest < MiniTest::Unit::TestCase

  include Nanoc3::TestHelpers

  include Nanoc3::Helpers::HTMLEscape

  def test_html_escape_with_string
    assert_equal('&lt;',    html_escape('<'))
    assert_equal('&gt;',    html_escape('>'))
    assert_equal('&amp;',   html_escape('&'))
    assert_equal('&quot;',  html_escape('"'))
  end

  def test_html_escape_with_block
    _erbout = 'moo'

    html_escape do
      _erbout << '<h1>Looks like a header</h1>'
    end

    assert_equal 'moo&lt;h1&gt;Looks like a header&lt;/h1&gt;', _erbout
  end

  def test_html_escape_without_string_or_block
    assert_raises RuntimeError do
      h
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nanoc3-3.2.4 test/helpers/test_html_escape.rb
nanoc3-3.2.3 test/helpers/test_html_escape.rb
nanoc3-3.2.2 test/helpers/test_html_escape.rb
nanoc3-3.2.1 test/helpers/test_html_escape.rb
nanoc3-3.2.0 test/helpers/test_html_escape.rb
nanoc3-3.2.0b3 test/helpers/test_html_escape.rb
nanoc3-3.2.0b2 test/helpers/test_html_escape.rb
nanoc3-3.2.0b1 test/helpers/test_html_escape.rb