Sha256: 8190aa4de1f0a10f433134aa6cbf459c7bf4c741523008c8e1bbbc3e645dca21

Contents?: true

Size: 888 Bytes

Versions: 11

Compression:

Stored size: 888 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class EscapeTest < Test::Unit::TestCase
  include Sinatra::Helpers::Html::Escape

  def test_h_should_escape_text
    assert_equal 'this &amp; that', h('this & that')
  end

  def test_h_should_return_blank_for_empty_string
    assert_equal '', h('')
  end

  def test_h_should_return_blank_for_nil
    assert_equal '', h(nil)
  end

  def test_hbang_should_escape_text
    assert_equal 'this &amp; that', h!('this & that')
  end

  def test_hbang_should_return_nbsp_for_empty_string
    assert_equal '&nbsp;', h!('')
  end

  def test_hbang_should_return_nbsp_for_nil
    assert_equal '&nbsp;', h!(nil)
  end

  def test_hbang_should_return_arbitrary_placeholder_for_empty_string
    assert_equal 'N/A', h!('', 'N/A')
  end

  def test_hbang_should_return_arbitrary_placeholder_for_nil
    assert_equal 'N/A', h!(nil, 'N/A')
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
sbfaulkner-sinatra-helpers-0.9.1 test/html/escape_test.rb
tdreyno-middleman-0.2.8 vendor/sinatra-helpers/test/html/escape_test.rb
tdreyno-middleman-0.2.9 vendor/sinatra-helpers/test/html/escape_test.rb
tdreyno-middleman-0.3.0 vendor/sinatra-helpers/test/html/escape_test.rb
tdreyno-middleman-0.3.1 vendor/sinatra-helpers/test/html/escape_test.rb
middleman-0.3.6 vendor/sinatra-helpers/test/html/escape_test.rb
middleman-0.3.5 vendor/sinatra-helpers/test/html/escape_test.rb
middleman-0.2.8 vendor/sinatra-helpers/test/html/escape_test.rb
middleman-0.2.9 vendor/sinatra-helpers/test/html/escape_test.rb
middleman-0.3.0 vendor/sinatra-helpers/test/html/escape_test.rb
middleman-0.3.1 vendor/sinatra-helpers/test/html/escape_test.rb