Sha256: 9781a8460cc5ec71ced6b730002c5a3b3fadbe9a6b68cefbf93b496acc03af71

Contents?: true

Size: 963 Bytes

Versions: 1

Compression:

Stored size: 963 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_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.changed?('unknown', 'old'))
    assert(@obj.changed?('alcn', 'other'))

    @website.verify
    item_tracker.verify
    ext.verify
  end

  def test_node_referenced?
    assert(@obj.node_referenced?('alcn', nil, 'alcn'))
    refute(@obj.node_referenced?('other', nil, 'alcn'))
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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