Sha256: 055dcd1bd2a0bd34f7fe1627dd989da24d2764326773b1e1fc9e9c5351443d8e

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

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

require 'spec'
require 'webrick'
require 'site/source_file_handler'
require 'cotta'

module BuildMaster

describe 'SourceFileHandler' do
  attr_reader :path_info

  it 'should_be_able_to_find_source' do
    server = WEBrick::HTTPServer.new(:Port => 2001)
    current_file = Cotta.file(__FILE__)
    dir = current_file.parent
    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 = dir.dir('content').path
    spec.output_dir = dir.dir('output').path
    file_handler = SourceFileHandler.new(server, spec)
    @path_info = '/markdown.markdown'
    file_handler.service(self, self)
    document = REXML::Document.new(self['body'])
    REXML::XPath.first(document, '/html/head/title').text.should == '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

1 entries across 1 versions & 1 rubygems

Version Path
BuildMaster-1.1.9 test/buildmaster/site/tc_source_file_handler.rb