test/base/test_compiler.rb in nanoc-4.0.0rc1 vs test/base/test_compiler.rb in nanoc-4.0.0rc2
- old
+ new
@@ -276,10 +276,37 @@
end
assert_match(/^The path returned for the.*does not start with a slash. Please ensure that all routing rules return a path that starts with a slash./, error.message)
end
end
+ def test_disallow_duplicate_routes
+ # Create site
+ Nanoc::CLI.run %w( create_site bar)
+
+ FileUtils.cd('bar') do
+ # Create routes
+ File.open('Rules', 'w') do |io|
+ io.write "compile '/**/*' do\n"
+ io.write "end\n"
+ io.write "\n"
+ io.write "route '/**/*' do\n"
+ io.write " '/index.html'\n"
+ io.write "end\n"
+ end
+
+ # Create files
+ File.write('content/foo.html', 'asdf')
+ File.write('content/bar.html', 'asdf')
+
+ # Create site
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
+ assert_raises(Nanoc::Int::Compiler::IdenticalRoutesError) do
+ site.compile
+ end
+ end
+ end
+
def test_load_should_be_idempotent
# Create site
Nanoc::CLI.run %w( create_site bar)
FileUtils.cd('bar') do
@@ -323,11 +350,11 @@
io.write " snapshot :aaa\n"
io.write " snapshot :aaa\n"
io.write "end\n"
io.write "\n"
io.write "route '/**/*' do\n"
- io.write " '/index.html'\n"
+ io.write " item.identifier.to_s\n"
io.write "end\n"
io.write "\n"
io.write "layout '/**/*', :erb\n"
end
@@ -599,10 +626,10 @@
io.write "compile '/**/*' do\n"
io.write " layout '/default.*'\n"
io.write "end\n"
io.write "\n"
io.write "route '/**/*' do\n"
- io.write " '/index.html'\n"
+ io.write " item.identifier.to_s\n"
io.write "end\n"
io.write "\n"
io.write "layout '/**/*', :erb\n"
end