Sha256: a27a5a3570b7340ecafb912464d98aca4e8cb18d68be9e663225e3f4756e141c
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
# -*- encoding: utf-8 -*- require 'webgen/test_helper' require 'webgen/tag/include_file' require 'fileutils' require 'tempfile' class TestTagIncludeFile < MiniTest::Unit::TestCase include Webgen::TestHelper def test_call setup_context content = "<a>This is 'a' Test</a>" file = Tempfile.new('webgen-test-file') file.write(content) file.close assert_tag_result([content, false], file.path, false, false) assert_tag_result([content, true], file.path, true, false) assert_tag_result([CGI::escapeHTML(content), true], file.path, true, true) @context[:config]['tag.include_file.filename'] = 'invalidfile' assert_raises(Webgen::RenderError) { Webgen::Tag::IncludeFile.call('include_file', '', @context) } end def assert_tag_result(result, filename, process, escape) @context[:config] = {'tag.include_file.filename' => filename, 'tag.include_file.process_output' => process, 'tag.include_file.escape_html' => escape} assert_equal(result, Webgen::Tag::IncludeFile.call('include_file', '', @context)) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
webgen-1.0.0.beta3 | test/webgen/tag/test_include_file.rb |
webgen-1.0.0.beta2 | test/webgen/tag/test_include_file.rb |
webgen-1.0.0.beta1 | test/webgen/tag/test_include_file.rb |