Sha256: 25ca16e6b5a9af6b4e04e237619511f347cb3b9122e2de0d039f401a10210f6f

Contents?: true

Size: 657 Bytes

Versions: 15

Compression:

Stored size: 657 Bytes

Contents

# encoding: utf-8

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

15 entries across 15 versions & 1 rubygems

Version Path
nanoc-3.7.4 test/helpers/test_html_escape.rb
nanoc-3.7.3 test/helpers/test_html_escape.rb
nanoc-3.7.2 test/helpers/test_html_escape.rb
nanoc-3.7.1 test/helpers/test_html_escape.rb
nanoc-3.7.0 test/helpers/test_html_escape.rb
nanoc-3.6.11 test/helpers/test_html_escape.rb
nanoc-3.6.10 test/helpers/test_html_escape.rb
nanoc-3.6.9 test/helpers/test_html_escape.rb
nanoc-3.6.8 test/helpers/test_html_escape.rb
nanoc-3.6.7 test/helpers/test_html_escape.rb
nanoc-3.6.6 test/helpers/test_html_escape.rb
nanoc-3.6.5 test/helpers/test_html_escape.rb
nanoc-3.6.4 test/helpers/test_html_escape.rb
nanoc-3.6.3 test/helpers/test_html_escape.rb
nanoc-3.6.2 test/helpers/test_html_escape.rb