Sha256: 90f7886bdc61bd079f9215c9030e01ee2a1e16e89317634e92cc6409be3ffdb3

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

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

require 'test/unit'
require 'buildmaster'

module BuildMaster

class SiteTest < Test::Unit::TestCase
  protected
  def setup
    super
    @temp = File.join(File.dirname(__FILE__), '..', '..', 'tmp')
    
    if (File.exist? @temp)
        delete_all(@temp)
    end
  end
  
  private
  def delete_all(directory)
      Dir.foreach(directory) do |name|
          if (name != '.' && name != '..')
            file = File.join(directory, name)
            if (File.directory? file)
                delete_all(file)
            else
                File.delete(file)
            end
          end
      end
      Dir.rmdir(directory)
  end
  
  public
  def test_should_build_based_on_content
      spec = SiteSpec.new
        spec.output_dir = File.join(@temp, 'output')
        spec.content_dir = File.join(File.dirname(__FILE__), 'content')
        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
      site = Site.new(spec)
      site.build
      output_index = File.join(@temp, 'output', 'index.html')
      assert_equal(true, File.exist?(@temp), "#{@temp}")
      assert_equal(true, File.exist?(output_index), "#{output_index} exists")
  end

end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
BuildMaster-0.5.0 test/buildmaster/tc_site.rb
BuildMaster-0.6.0 test/buildmaster/tc_site.rb
BuildMaster-0.7.0 test/buildmaster/tc_site.rb