Sha256: c9cd506d570d72a2b05cd350a93eb6bf403a30a9844667cc2d150e5a80de8f9e

Contents?: true

Size: 1.54 KB

Versions: 2

Compression:

Stored size: 1.54 KB

Contents

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

require 'spec'
require 'buildmaster'
require 'buildmaster/cotta'
require 'buildmaster/cotta/in_memory_system'

module BuildMaster

context 'Site Specification' do
  setup do
    @cotta = Cotta.new(InMemorySystem.new)
  end

  specify 'get relative path' do
    spec = SiteSpec.new(nil, @cotta)
    spec.content_dir = '/one/two/content'
    spec.relative_to_root(@cotta.file('/one/two/content/images/logo.gif')).to_s.should_equal('images/logo.gif')
  end
  
  specify 'supports windows path' do
    spec = SiteSpec.new(nil, @cotta)
    spec.content_dir = 'C:\Work\project\content'
    spec.relative_to_root(@cotta.file('C:\Work\project\content\images\logo.gif')).to_s.should_equal('images/logo.gif')
  end
  
  specify 'initialization with block' do
    spec = SiteSpec.new(__FILE__, @cotta) 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 = @cotta.dir(__FILE__).parent
    spec.content_dir.should_equal(root.dir('content'))
    spec.output_dir.should_equal(root.dir('output'))
    spec.load_template_source.to_s.include?('first menu group').should_equal true
  end
  
end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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