Sha256: 551928ec3bf13684b430783ce68dd26ba4047ca0c18e153dd8ba354966076033

Contents?: true

Size: 966 Bytes

Versions: 2

Compression:

Stored size: 966 Bytes

Contents

$:.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 = <<CONTENT
<item>
  text
  <one>test</one>
  <two></two>
</item>
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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
BuildMaster-0.8.0 test/buildmaster/templatelets/tc_include.rb
BuildMaster-0.8.1 test/buildmaster/templatelets/tc_include.rb