test/base/test_compiler_dsl.rb in nanoc-3.4.3 vs test/base/test_compiler_dsl.rb in nanoc-3.5.0b1
- old
+ new
@@ -14,9 +14,33 @@
def test_layout
# TODO implement
end
+ def test_include_rules
+ # Create site
+ Nanoc::CLI.run %w( create_site with_bonus_rules )
+ FileUtils.cd('with_bonus_rules') do
+ # Create rep
+ item = Nanoc::Item.new('foo', { :extension => 'bar' }, '/foo/')
+ rep = Nanoc::ItemRep.new(item, :default)
+
+ # Create a bonus rules file
+ File.open('more_rules.rb', 'w') { |io| io.write "passthrough '/foo/'" }
+
+ # Create other necessary stuff
+ site = Nanoc::Site.new('.')
+ site.items << item
+ dsl = site.compiler.rules_collection.dsl
+
+ # Include rules
+ dsl.include_rules 'more_rules'
+
+ # Check that the rule made it into the collection
+ refute_nil site.compiler.rules_collection.routing_rule_for(rep)
+ end
+ end
+
def test_passthrough
with_site do
# Create rules
File.open('Rules', 'w') do |io|
io.write <<EOS