Sha256: 39019f65de53c5edded18811150c7d58548cb2a9fd429cd1c9c069dfe35669ae

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 KB

Contents

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

require 'test/unit'
require 'helper'
require 'webgen/sourcehandler'
require 'stringio'

class TestSourceHandlerMemory < Test::Unit::TestCase

  include Test::WebsiteHelper

  def test_all
    obj = Webgen::SourceHandler::Memory.new
    root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
    shm = Webgen::SourceHandler::Main.new # for using service :create_nodes
    root.unflag(:dirty)
    root.unflag(:created)

    node = obj.create_node(root, path_with_meta_info('/test.png'), '/', 'data')
    assert_equal('/', node.node_info[:memory_source_alcn])
    assert_equal('data', obj.content(node))
    assert(!node.flagged(:reinit))
    root.tree.delete_node(node)

    node = obj.create_node(root, path_with_meta_info('/test.png'), '/') {|n| assert_equal(node, n); 'data'}
    assert_equal('/', node.node_info[:memory_source_alcn])
    assert_equal('data', obj.content(node))
    assert(!node.flagged(:reinit))

    assert(!root.flagged(:dirty))
    node.flag(:reinit)
    assert(root.flagged(:dirty))
    root.unflag(:dirty)
    root.tree.delete_node(node)

    node = obj.create_node(root, path_with_meta_info('/test.png'), '/', 'data')
    assert_equal('/', node.node_info[:memory_source_alcn])
    obj.instance_eval { @data = nil }
    assert_nil(obj.content(node))
    assert(node.flagged(:reinit))
    assert(root.flagged(:dirty))
  end

end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
gettalong-webgen-0.5.7.20090227 test/test_sourcehandler_memory.rb
thewoolleyman-webgen-0.5.8.20090419 test/test_sourcehandler_memory.rb
webgen-0.5.7 test/test_sourcehandler_memory.rb