Sha256: fd6585342e636385830e4904730c3243cc71dc8ac522a4caab294e6b40d83285

Contents?: true

Size: 1019 Bytes

Versions: 2

Compression:

Stored size: 1019 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

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 = <<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)
    REXML::XPath.first(target, 'one').text.should_equal 'test'
    target.text.strip!.should_equal 'text'
  end
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
BuildMaster-0.9.0 test/buildmaster/templatelets/tc_include.rb
BuildMaster-0.9.1 test/buildmaster/templatelets/tc_include.rb