test/base/test_compiler_dsl.rb in nanoc-3.6.7 vs test/base/test_compiler_dsl.rb in nanoc-3.6.8

- old
+ new

@@ -12,10 +12,29 @@ def test_layout # TODO implement end + def test_preprocess_twice + rules_collection = Nanoc::RulesCollection.new(nil) + compiler_dsl = Nanoc::CompilerDSL.new(rules_collection, {}) + + # first time + io = capturing_stdio do + compiler_dsl.preprocess {} + end + assert_empty io[:stdout] + assert_empty io[:stderr] + + # second time + io = capturing_stdio do + compiler_dsl.preprocess {} + end + assert_empty io[:stdout] + assert_match(/WARNING: A preprocess block is already defined./, io[:stderr]) + end + def test_include_rules # Create site Nanoc::CLI.run %w( create_site with_bonus_rules ) FileUtils.cd('with_bonus_rules') do # Create rep @@ -42,10 +61,10 @@ with_site do # Create rules File.open('Rules', 'w') do |io| io.write <<EOS passthrough "/robots/" - + compile '*' do ; end route '*' do ; item.identifier.chop + '-xyz' + item[:extension] ; end EOS end