Sha256: 2a2c88a1f9d8f6a2d1caeebe12575dc7027f369e9b2897ff4d89382dd97d53e7

Contents?: true

Size: 636 Bytes

Versions: 19

Compression:

Stored size: 636 Bytes

Contents

class Nanoc::Helpers::HTMLEscapeTest < Nanoc::TestCase
  include Nanoc::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

19 entries across 19 versions & 1 rubygems

Version Path
nanoc-4.1.6 test/helpers/test_html_escape.rb
nanoc-4.1.5 test/helpers/test_html_escape.rb
nanoc-4.1.4 test/helpers/test_html_escape.rb
nanoc-4.1.3 test/helpers/test_html_escape.rb
nanoc-4.1.2 test/helpers/test_html_escape.rb
nanoc-4.1.1 test/helpers/test_html_escape.rb
nanoc-4.1.0 test/helpers/test_html_escape.rb
nanoc-4.1.0rc2 test/helpers/test_html_escape.rb
nanoc-4.1.0rc1 test/helpers/test_html_escape.rb
nanoc-4.1.0b1 test/helpers/test_html_escape.rb
nanoc-4.1.0a1 test/helpers/test_html_escape.rb
nanoc-4.0.2 test/helpers/test_html_escape.rb
nanoc-4.0.1 test/helpers/test_html_escape.rb
nanoc-4.0.0 test/helpers/test_html_escape.rb
nanoc-4.0.0rc3 test/helpers/test_html_escape.rb
nanoc-4.0.0rc2 test/helpers/test_html_escape.rb
nanoc-4.0.0rc1 test/helpers/test_html_escape.rb
nanoc-4.0.0b4 test/helpers/test_html_escape.rb
nanoc-4.0.0b3 test/helpers/test_html_escape.rb