Sha256: ddd7a1e84931b4a66489ad9018bf07532a001cce48af31f30c50c5914bfde375

Contents?: true

Size: 946 Bytes

Versions: 15

Compression:

Stored size: 946 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'webgen/test_helper'
require 'webgen/tag/meta_info'
require 'time'

class TestTagMetaInfo < Minitest::Test

  include Webgen::TestHelper

  def test_call
    setup_context
    node = Webgen::Node.new(@website.tree.dummy_root, 'test', 'test', 'lang' => 'en', 'key' => 'value <br />')
    @context[:chain] = [node]

    @context[:config] = {'tag.meta_info.escape_html' => true}
    assert_equal("en", Webgen::Tag::MetaInfo.call('lang', '', @context))
    assert_equal("value &lt;br /&gt;", Webgen::Tag::MetaInfo.call('key', '', @context))
    assert_equal("", Webgen::Tag::MetaInfo.call('invalid', '', @context))

    @context[:config] = {'tag.meta_info.escape_html' => false}
    assert_equal("value <br />", Webgen::Tag::MetaInfo.call('key', '', @context))

    @context[:config] = {'tag.meta_info.mi' => 'key'}
    assert_equal("value <br />", Webgen::Tag::MetaInfo.call('meta_info', '', @context))
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
webgen-1.7.3 test/webgen/tag/test_meta_info.rb
webgen-1.7.2 test/webgen/tag/test_meta_info.rb
webgen-1.7.1 test/webgen/tag/test_meta_info.rb
webgen-1.7.0 test/webgen/tag/test_meta_info.rb
webgen-1.6.0 test/webgen/tag/test_meta_info.rb
webgen-1.5.2 test/webgen/tag/test_meta_info.rb
webgen-1.5.1 test/webgen/tag/test_meta_info.rb
webgen-1.5.0 test/webgen/tag/test_meta_info.rb
webgen-1.4.1 test/webgen/tag/test_meta_info.rb
webgen-1.4.0 test/webgen/tag/test_meta_info.rb
webgen-1.3.0 test/webgen/tag/test_meta_info.rb
webgen-1.2.1 test/webgen/tag/test_meta_info.rb
webgen-1.2.0 test/webgen/tag/test_meta_info.rb
webgen-1.1.0 test/webgen/tag/test_meta_info.rb
webgen-1.0.0 test/webgen/tag/test_meta_info.rb