Sha256: fd6f853463acb5a8d7f01c42955f0843bc9470bf4ffb030cbe55033b1ff7b6db
Contents?: true
Size: 971 Bytes
Versions: 3
Compression:
Stored size: 971 Bytes
Contents
require 'test/unit' require 'html/template/pro' class TestRegister < Test::Unit::TestCase def test_register HTML::Template::Expr.register_function(:directory_exists) { |dir| FileTest.directory? dir } HTML::Template::Expr.register_function(:commify => lambda do |x| x = x.to_s 1 while x.gsub!(/^([-+]?\d+)(\d{3})/, '\1,\2') return x end) template = HTML::Template::Expr.new(:path => ['test/templates'], :filename => 'register.tmpl') output = template.output assert_match(/^OK/, output, 'directory_exists()') assert_match(/2,000/, output, 'comify') begin HTML::Template::Expr.register_function(:foo => 'bar'); rescue => e assert_match(/must be kind_of Proc/, e.message, 'type check') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
html-template-pro-0.0.3 | test/test_register.rb |
html-template-pro-0.0.2 | test/test_register.rb |
html-template-pro-0.0.1 | test/test_register.rb |