Sha256: 7f3a2904121ae4b2f49ebc2f7c6d85071f4cb58c001d98f2f0b90493527b21fd

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

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

2 entries across 2 versions & 1 rubygems

Version Path
BuildMaster-0.8.0 test/buildmaster/site/tc_site.rb
BuildMaster-0.8.1 test/buildmaster/site/tc_site.rb