test/cli/commands/test_create_site.rb in nanoc-4.0.0b1 vs test/cli/commands/test_create_site.rb in nanoc-4.0.0b2

- old
+ new

@@ -37,10 +37,34 @@ assert File.file?('output/blah') end end + def test_can_compile_site_in_nonempty_directory + FileUtils.mkdir('foo') + FileUtils.touch(File.join('foo', 'SomeFile.txt')) + Nanoc::CLI.run %w( create_site foo --force ) + + FileUtils.cd('foo') do + site = Nanoc::Int::Site.new('.') + site.compile + end + end + + def test_compiled_site_output + FileUtils.mkdir('foo') + FileUtils.touch(File.join('foo', 'SomeFile.txt')) + Nanoc::CLI.run %w( create_site foo --force ) + + FileUtils.cd('foo') do + site = Nanoc::Int::Site.new('.') + site.compile + + assert File.file?('output/index.html') + end + end + def test_default_encoding unless defined?(Encoding) skip 'No Encoding class' return end @@ -59,15 +83,15 @@ end assert_equal 'Could not read content/index.html because the file is not valid UTF-8.', exception.message # Try with encoding = specific File.open('nanoc.yaml', 'w') do |io| - io.write("pattern_syntax: glob\n") + io.write("string_pattern_type: glob\n") io.write("data_sources:\n") io.write(" -\n") io.write(" type: filesystem_unified\n") - io.write(" identifier_style: full\n") + io.write(" identifier_type: full\n") end site = Nanoc::Int::Site.new('.') site.compile end FileUtils @@ -80,8 +104,22 @@ FileUtils.cd('foo') do Nanoc::CLI.run %w( compile ) assert File.file?('content/stylesheet.css') assert_match(/\/stylesheet.css/, File.read('output/index.html')) + end + end + + def test_new_site_prunes_by_default + FileUtils.mkdir('foo') + FileUtils.touch(File.join('foo', 'SomeFile.txt')) + Nanoc::CLI.run %w( create_site foo --force ) + + FileUtils.cd('foo') do + File.write('output/blah.txt', 'stuff') + + Nanoc::CLI.run %w( compile ) + + refute File.file?('output/blah.txt') end end end