Sha256: 92d5cefa7a746de9d537add67c614c38c40fa1b1427b4f0897260bc0666eee8c

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

$:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib")

require 'test/unit'
require 'buildmaster'
require 'webrick'
require 'source_file_handler'

module BuildMaster

class SourceFileHandlerTest < Test::Unit::TestCase
  attr_reader :path_info

  def test_should_be_able_to_find_source
    server = WEBrick::HTTPServer.new
    dir = File.dirname(__FILE__)
    spec = SiteSpec.new
    spec.template =<<TEMPLATE
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:template="http://buildmaster.rubyforge.org/xtemplate/1.0">
  <head>
    <title>Title</title>
  </head>
  <body>
  </body>
</html>
TEMPLATE
    spec.content_dir = File.join(dir, 'site', 'content')
    spec.output_dir = File.join(dir, 'output')
    file_handler = SourceFileHandler.new(server, spec)
    @path_info = '/markdown.html'
    file_handler.service(self, self)
    document = REXML::Document.new(self['body'])
    assert_equal('Title', REXML::XPath.first(document, '/html/head/title').text)
  end
  
  def []=(name, value)
    logged_properties[name] = value
  end
  
  def [](name)
    logged_properties[name]
  end
  
  def logged_properties
    @logged_properties = Hash.new unless (@logged_properties)
    return @logged_properties
  end
  
  def body=(value)
    self['body']=value
  end
  
end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
BuildMaster-0.8.0 test/buildmaster/tc_source_file_handler.rb