From d3b836ac4a35c1599be1fea0b72d5f19a9a37d4e Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Mon, 18 Feb 2013 10:26:59 -0800 Subject: Add message when you have no routes defined. Print a message in both `rake routes` and at GET "/rails/info/routes" that lets you know you have no routes defined, as well as linking to the Rails Guide on the topic. --- railties/test/application/rake_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'railties/test/application') diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index a8275a2e76..a205b289fe 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -143,6 +143,21 @@ module ApplicationTests assert_equal "cart GET /cart(.:format) cart#show\n", Dir.chdir(app_path){ `rake routes` } end + def test_rake_routes_displays_message_when_no_routes_are_defined + app_file "config/routes.rb", <<-RUBY + AppTemplate::Application.routes.draw do + end + RUBY + + assert_equal <<-MESSAGE, Dir.chdir(app_path){ `rake routes` } +You don't have any routes defined! + +Please add some routes in config/routes.rb. + +For more information about routes, see the Rails Guide: http://guides.rubyonrails.org/routing.html . +MESSAGE + end + def test_logger_is_flushed_when_exiting_production_rake_tasks add_to_config <<-RUBY rake_tasks do -- cgit v1.2.3