test/buildmaster/site/tc_site.rb in BuildMaster-1.0.9 vs test/buildmaster/site/tc_site.rb in BuildMaster-1.1.9
- old
+ new
@@ -6,29 +6,28 @@
require 'cotta/command_interface'
require 'cotta/in_memory_system'
module BuildMaster
-context 'Site' do
- setup do
+describe 'Site' do
+ before do
@system = InMemorySystem.new
@cotta = Cotta.new(@system)
@root = @cotta.dir('site')
end
- specify 'should build base on content' do
+ it 'should build base on content' do
content_dir = @root.dir('content')
- content_dir.file('index.html').save(<<CONTENT
+ content_dir.file('index.html').save(<<CONTENT)
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body><h1>Text</h1>
</body>
</html>
CONTENT
-)
content_dir.file('markdown.markdown').save(<<CONTENT)
--------------------
markdown title
--------------------
Header
@@ -60,11 +59,11 @@
@root.exists?.should ==(true)
expected_output_file.exists?.should ==(true)
end
- specify 'ignore the svn and CVS directories' do
+ it 'ignore the svn and CVS directories' do
content_dir = @root.dir('content')
content_dir.dir('.svn').mkdirs
content_dir.dir('_svn').mkdirs
content_dir.dir('CVS').mkdirs
spec = SiteSpec.new(nil, @cotta)
@@ -75,11 +74,28 @@
TEMPLATE
site = Site.new(spec)
site.build
@root.dir('output').list.size.should == 0
end
+
+ it 'only build if source is out of date' do
+ content_dir = @root.dir('content')
+ content_dir.file('test.textile').save(<<CONTENT)
+---------------
+title
+---------------
+h1. header
+CONTENT
+ output_dir = @root.file('output/test.html').save('content')
+ spec = SiteSpec.new(nil, @cotta)
+ spec.output_dir = 'site/output'
+ spec.content_dir = 'site/content'
+ spec.template = "<html/>"
+ Site.new(spec).build
+ @root.file('output/test.html').load.should == 'content'
+ end
- specify 'set up site based on the template' do
+ it 'set up site based on the template' do
templates_dir = @cotta.dir('templates')
setup_template_choice_one(templates_dir)
setup_template_choice_two(templates_dir)
command_io = mock('command line io')
command_io.should_receive(:puts).exactly(4).times
\ No newline at end of file