Sha256: f52ea2177443648a5d854818b54d5713badd81487c8b5d486016916ddc4d24af

Contents?: true

Size: 1.31 KB

Versions: 9

Compression:

Stored size: 1.31 KB

Contents

require 'test/unit'
require 'helper'
require 'webgen/tree'
require 'webgen/contentprocessor'
require 'webgen/tag'

class TestTagSitemap < Test::Unit::TestCase

  include Test::WebsiteHelper

  def setup
    super
    @obj = Webgen::Tag::Sitemap.new
  end

  def call(context, honor_in_menu, any_lang, used_kinds)
    @obj.set_params({'common.sitemap.honor_in_menu' => honor_in_menu,
                      'common.sitemap.any_lang' => any_lang,
                      'common.sitemap.used_kinds' => used_kinds})
    result = @obj.call('sitemap', '', context)
    @obj.set_params({})
    result
  end

  def test_call
    nodes = create_sitemap_nodes
    context = Webgen::ContentProcessor::Context.new(:chain => [nodes[:file11_en]])

    assert_equal("<ul><li><a href=\"./\"></a>" +
                 "<ul><li><span></span>"+
                 "<ul><li><a href=\"#f1\"></a></li></ul></li></ul></li>" +
                 "<li><a href=\"../dir2/\"></a>" +
                 "<ul><li><a href=\"../dir2/file21.en.html\"></a></li></ul></li>"+
                 "<li><a href=\"../index.en.html\"></a></li></ul>",
                 call(context, false, false, []))
    assert_equal("",
                 call(context, false, false, ['noone']))
  end

  def test_tag_config_base
    assert_equal('common.sitemap', @obj.send(:tag_config_base))
  end

end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
gettalong-webgen-0.5.4.20080929 test/test_tag_sitemap.rb
gettalong-webgen-0.5.5.20081001 test/test_tag_sitemap.rb
gettalong-webgen-0.5.5.20081010 test/test_tag_sitemap.rb
gettalong-webgen-0.5.5.20081012 test/test_tag_sitemap.rb
gettalong-webgen-0.5.6.20081020 test/test_tag_sitemap.rb
webgen-0.5.3 test/test_tag_sitemap.rb
webgen-0.5.4 test/test_tag_sitemap.rb
webgen-0.5.6 test/test_tag_sitemap.rb
webgen-0.5.5 test/test_tag_sitemap.rb