Sha256: cac8a8510b0519021fd8bb1b80942aebb1218559ccdcd2c5491d2269c0454852

Contents?: true

Size: 675 Bytes

Versions: 2

Compression:

Stored size: 675 Bytes

Contents

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

class TestTempleFiltersEscapable < TestFilter(:Escapable)
  def test_escape
    exp = @filter.compile([:multi,
      [:escape, [:dynamic, "@hello"]],
      [:escape, [:block, "@world"]]
    ])
    
    assert_equal([:multi,
      [:dynamic, "CGI.escapeHTML((@hello).to_s)"],
      [:block, "CGI.escapeHTML((@world).to_s)"]
    ], exp)
  end

  def test_escape_static_content
    exp = @filter.compile([:multi,
      [:escape, [:static, "<hello>"]],
      [:escape, [:block, "@world"]]
    ])
    
    assert_equal([:multi,
      [:static, "&lt;hello&gt;"],
      [:block, "CGI.escapeHTML((@world).to_s)"]
    ], exp)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
temple-0.1.1 test/filters/test_escapable.rb
temple-0.1.0 test/filters/test_escapable.rb