aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/rake_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/application/rake_test.rb')
-rw-r--r--railties/test/application/rake_test.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb
index a8275a2e76..09f2ad1209 100644
--- a/railties/test/application/rake_test.rb
+++ b/railties/test/application/rake_test.rb
@@ -1,5 +1,6 @@
# coding:utf-8
require "isolation/abstract_unit"
+require "active_support/core_ext/string/strip"
module ApplicationTests
class RakeTest < ActiveSupport::TestCase
@@ -140,7 +141,24 @@ module ApplicationTests
get '/cart', to: 'cart#show'
end
RUBY
- assert_equal "cart GET /cart(.:format) cart#show\n", Dir.chdir(app_path){ `rake routes` }
+
+ output = Dir.chdir(app_path){ `rake routes` }
+ assert_equal "Prefix Verb URI Pattern Controller#Action\ncart GET /cart(.:format) cart#show\n", output
+ 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.strip_heredoc, 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