Sha256: ca409d6322c0765e0e6444629760987b841f1fa3b514c9eebd3afb316e08865f

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

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

require 'test/unit'
require 'buildmaster'

module BuildMaster

class SiteSpecTest < Test::Unit::TestCase

  def test_should_get_relative_path
    spec = SiteSpec.new()
    spec.content_dir = '/one/two/content'
    assert_equal('images/logo.gif', spec.relative_to_root('/one/two/content/images/logo.gif').to_s)
  end
  
  def test_should_support_windows_path
    spec = SiteSpec.new()
    spec.content_dir = "C:\\Work\\project\\content"
    assert_equal('images/logo.gif', spec.relative_to_root('C:\\Work\\project\\content\\images\\logo.gif').to_s)
  end
  
  def test_initialize_with_block
    spec = SiteSpec.new(__FILE__) do |sitespec|
      sitespec.content_dir = 'content'
      sitespec.output_dir = 'output'
      sitespec.page_layout = <<CONTENT
title_header: BuildMaster - 
css_path: css.css
logo:
  path: logo.gif
  link: index.html
menu_groups:
- title: first menu group
  menu_items:
  - title: item one for g1
    link: item_one.html
  - title: item two for g2
    link: item_two.html
- title: second menu group
CONTENT
    end
    root = File.dirname(__FILE__)
    assert_equal(File.join(root, 'content'), spec.content_dir)
    assert_equal(File.join(root, 'output'), spec.output_dir)
    assert_equal(true, spec.load_template_source.to_s.include?('first menu group'))
  end
  
end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
BuildMaster-0.8.0 test/buildmaster/tc_site_spec.rb
BuildMaster-0.8.1 test/buildmaster/tc_site_spec.rb