Sha256: 5b93cea2b5181846e75ee19afe0f2b422af3f1a67f5a8c7fc21bf41a32a68a9d

Contents?: true

Size: 918 Bytes

Versions: 15

Compression:

Stored size: 918 Bytes

Contents

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

require 'minitest/autorun'
require 'webgen/item_tracker/node_content'

class TestNodeContent < Minitest::Test

  def setup
    @website = Object.new
    @obj = Webgen::ItemTracker::NodeContent.new(@website)
  end

  def test_item_id
    s = 'id'
    def s.alcn; self; end
    assert_equal('id', @obj.item_id(s))
  end

  def test_item_data
    assert_nil(@obj.item_data('alcn'))
  end

  def test_item_changed?
    ext = OpenStruct.new
    ext.item_tracker = Object.new
    ext.item_tracker.define_singleton_method(:node_changed?) {|n| raise unless n == :node; true}
    @website.define_singleton_method(:ext) { ext }
    @website.define_singleton_method(:tree) { {'alcn' => :node} }

    assert(@obj.item_changed?('unknown', 'old'))
    assert(@obj.item_changed?('alcn', 'other'))
  end

  def test_referenced_nodes
    assert_equal(['alcn'], @obj.referenced_nodes('alcn', nil))
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

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