Sha256: d16a95d65c72b9b4e15fec8633648e52d387e07abe95fa6fb2a9b973e5804da4
Contents?: true
Size: 1.93 KB
Versions: 1
Compression:
Stored size: 1.93 KB
Contents
# -*- encoding: utf-8 -*- require 'webgen/test_helper' require 'webgen/item_tracker/nodes' require 'webgen/node_finder' class TestItemTrackerNodes < MiniTest::Unit::TestCase include Webgen::TestHelper def self.node_list(website, options) website.tree.root.children end def setup setup_website('node_finder.option_sets' => {}) @website.ext.node_finder = Webgen::NodeFinder.new(@website) @obj = Webgen::ItemTracker::Nodes.new(@website) @args1 = [['TestItemTrackerNodes', 'node_list'], {}, :meta_info] @args2 = [:node_finder_option_set, {:opts => {:alcn => '/file*'}, :ref_alcn => '/'}, :meta_info] end def test_item_id assert_equal(@args1, @obj.item_id(*@args1)) assert_equal(@args2, @obj.item_id(*@args2)) end def test_item_data setup_default_nodes(@website.tree) assert_equal(["/file.en.html", "/file.de.html", "/other.html", "/other.en.html", "/german.de.html", "/dir/", "/dir2/"], @obj.item_data(*@args1)) assert_equal([["/file.en.html", [["/file.en.html#frag", ["/file.en.html#nested"]]]], ["/file.de.html", ["/file.de.html#frag"]]], @obj.item_data(*@args2)) end def test_changed? setup_default_nodes(@website.tree) @website.ext.item_tracker = MiniTest::Mock.new @website.ext.item_tracker.expect(:item_changed?, false, [:node_meta_info, nil]) [@args1, @args2].each do |args| old_data = @obj.item_data(*args) assert(@obj.changed?(args, [])) refute(@obj.changed?(args, old_data)) end end def test_node_referenced? setup_default_nodes(@website.tree) assert(@obj.node_referenced?(@args1, @obj.item_data(*@args1), '/file.en.html')) refute(@obj.node_referenced?(@args1, @obj.item_data(*@args1), '/dir/file.html')) assert(@obj.node_referenced?(@args2, @obj.item_data(*@args2), '/file.en.html')) refute(@obj.node_referenced?(@args2, @obj.item_data(*@args2), '/other.en.html')) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
webgen-1.0.0.beta1 | test/webgen/item_tracker/test_nodes.rb |