test/buildmaster/tc_site_spec.rb in BuildMaster-0.8.1 vs test/buildmaster/tc_site_spec.rb in BuildMaster-0.9.0
- old
+ new
@@ -1,28 +1,33 @@
$:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib")
-require 'test/unit'
+require 'spec'
require 'buildmaster'
+require 'buildmaster/cotta'
+require 'buildmaster/cotta/in_memory_system'
module BuildMaster
-class SiteSpecTest < Test::Unit::TestCase
+context 'Site Specification' do
+ setup do
+ @cotta = Cotta.new(InMemorySystem.new)
+ end
- def test_should_get_relative_path
- spec = SiteSpec.new()
+ specify 'get relative path' do
+ spec = SiteSpec.new(nil, @cotta)
spec.content_dir = '/one/two/content'
- assert_equal('images/logo.gif', spec.relative_to_root('/one/two/content/images/logo.gif').to_s)
+ spec.relative_to_root(@cotta.file('/one/two/content/images/logo.gif')).to_s.should_equal('images/logo.gif')
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)
+ 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
- def test_initialize_with_block
- spec = SiteSpec.new(__FILE__) do |sitespec|
+ 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
@@ -37,13 +42,13 @@
- 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'))
+ 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
\ No newline at end of file