Sha256: bc24cb74534f4726fbf0f5ed7deada0dd961f28e3426a87857e0fb1d5e2d30fb

Contents?: true

Size: 930 Bytes

Versions: 1

Compression:

Stored size: 930 Bytes

Contents

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

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

class TestNodeContent < MiniTest::Unit::TestCase

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

  def test_item_id
    assert_equal('id', @obj.item_id('id'))
  end

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

  def test_item_changed?
    item_tracker = MiniTest::Mock.new
    item_tracker.expect(:node_changed?, true, [:node])
    ext = MiniTest::Mock.new
    ext.expect(:item_tracker, item_tracker)
    @website.expect(:ext, ext)
    @website.expect(:tree, {'alcn' => :node})

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

    @website.verify
    item_tracker.verify
    ext.verify
  end

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
webgen-1.0.0.beta2 test/webgen/item_tracker/test_node_content.rb