aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2013-02-18 10:26:59 -0800
committerSteve Klabnik <steve@steveklabnik.com>2013-02-18 16:09:37 -0800
commitd3b836ac4a35c1599be1fea0b72d5f19a9a37d4e (patch)
tree9244b360a04ee5aaadb6b96810d8f9f51176af9c /railties
parent8fd17e0c4120f762f87b88d0ccc7c75e2ae2e3ed (diff)
downloadrails-d3b836ac4a35c1599be1fea0b72d5f19a9a37d4e.tar.gz
rails-d3b836ac4a35c1599be1fea0b72d5f19a9a37d4e.tar.bz2
rails-d3b836ac4a35c1599be1fea0b72d5f19a9a37d4e.zip
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.
Diffstat (limited to 'railties')
-rw-r--r--railties/test/application/rake_test.rb15
1 files changed, 15 insertions, 0 deletions
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