$:.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 context 'IncludeTest' do include HelperMethods setup do setup_spec end specify 'should_include_the_source' do 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) REXML::XPath.first(target, 'one').text.should_equal 'test' target.text.strip!.should_equal 'text' end end end