Sha256: 4ce448f5f365e7a43403a3ab12dbd21156e61b1f31e195c7111586d958112168

Contents?: true

Size: 696 Bytes

Versions: 17

Compression:

Stored size: 696 Bytes

Contents

# encoding: utf-8

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

  include Nanoc::TestHelpers

  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

17 entries across 17 versions & 1 rubygems

Version Path
nanoc-3.6.1 test/helpers/test_html_escape.rb
nanoc-3.6.0 test/helpers/test_html_escape.rb
nanoc-3.5.0 test/helpers/test_html_escape.rb
nanoc-3.5.0b2 test/helpers/test_html_escape.rb
nanoc-3.5.0b1 test/helpers/test_html_escape.rb
nanoc-3.4.3 test/helpers/test_html_escape.rb
nanoc-3.4.2 test/helpers/test_html_escape.rb
nanoc-3.4.1 test/helpers/test_html_escape.rb
nanoc-3.4.0 test/helpers/test_html_escape.rb
nanoc-3.3.7 test/helpers/test_html_escape.rb
nanoc-3.3.6 test/helpers/test_html_escape.rb
nanoc-3.3.5 test/helpers/test_html_escape.rb
nanoc-3.3.4 test/helpers/test_html_escape.rb
nanoc-3.3.3 test/helpers/test_html_escape.rb
nanoc-3.3.2 test/helpers/test_html_escape.rb
nanoc-3.3.1 test/helpers/test_html_escape.rb
nanoc-3.3.0 test/helpers/test_html_escape.rb