$:.unshift File.dirname(__FILE__) require 'common_templatelet_test' $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib') require 'rexml/document' require 'rexml/element' require 'buildmaster/site_spec' require 'buildmaster/source_content' require 'buildmaster/templatelets/include' module BuildMaster class IncludeTest < CommonTemplateletTest def test_should_include_the_source target = create_element('target') template = create_element('include') template.attributes['elements'] = '/item/*' source_content = < text test CONTENT source = SourceContent.new(Pathname.new('doc/index.html'), REXML::Document.new(source_content)) include = Include.new(SiteSpec.new) include.process(target, template, source) assert_equal('test', REXML::XPath.first(target, 'one').text) assert_equal('text', target.text.strip!) end end end