Sha256: b36c2c035103ef9a8e71f456999a885033a1481257d95094861249065c69f9df

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

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

require 'spec'
require 'buildmaster'
require 'webrick'
require 'source_file_handler'

module BuildMaster

context 'SourceFileHandler' do
  attr_reader :path_info

  specify 'should_be_able_to_find_source' do
    server = WEBrick::HTTPServer.new(:Port => 2000)
    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'])
    REXML::XPath.first(document, '/html/head/title').text.should_equal 'Title'
  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

2 entries across 2 versions & 1 rubygems

Version Path
BuildMaster-0.9.0 test/buildmaster/tc_source_file_handler.rb
BuildMaster-0.9.1 test/buildmaster/tc_source_file_handler.rb