aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
diff options
context:
space:
mode:
authorJose and Yehuda <wycats@gmail.com>2012-04-25 16:06:20 -0500
committerYehuda Katz <wycats@gmail.com>2012-04-25 16:07:17 -0500
commit6acebb38bc0637bc05c19d87f8767f16ce79189b (patch)
treee37fa39f516e16c1d36e3b5202e9231c56aa4305 /railties/test/application
parent3c100cfe8ed5a875b0bbdc8fa4e8f2b0cbf78676 (diff)
downloadrails-6acebb38bc0637bc05c19d87f8767f16ce79189b.tar.gz
rails-6acebb38bc0637bc05c19d87f8767f16ce79189b.tar.bz2
rails-6acebb38bc0637bc05c19d87f8767f16ce79189b.zip
Allow loading external route files from the router
This feature enables the ability to load an external routes file from the router via: draw :filename External routes files go in +config/routes+. This feature works in both engines and applications.
Diffstat (limited to 'railties/test/application')
-rw-r--r--railties/test/application/paths_test.rb2
-rw-r--r--railties/test/application/routing_test.rb24
2 files changed, 26 insertions, 0 deletions
diff --git a/railties/test/application/paths_test.rb b/railties/test/application/paths_test.rb
index 4029984ce9..e0893f53be 100644
--- a/railties/test/application/paths_test.rb
+++ b/railties/test/application/paths_test.rb
@@ -50,6 +50,8 @@ module ApplicationTests
assert_path @paths["config/locales"], "config/locales/en.yml"
assert_path @paths["config/environment"], "config/environment.rb"
assert_path @paths["config/environments"], "config/environments/development.rb"
+ assert_path @paths["config/routes.rb"], "config/routes.rb"
+ assert_path @paths["config/routes"], "config/routes"
assert_equal root("app", "controllers"), @paths["app/controllers"].expanded.first
end
diff --git a/railties/test/application/routing_test.rb b/railties/test/application/routing_test.rb
index 204f43a442..1dac086119 100644
--- a/railties/test/application/routing_test.rb
+++ b/railties/test/application/routing_test.rb
@@ -166,6 +166,30 @@ module ApplicationTests
assert_equal 'WIN', last_response.body
end
+ test "routes drawing from config/routes" do
+ app_file 'config/routes.rb', <<-RUBY
+ AppTemplate::Application.routes.draw do
+ draw :external
+ end
+ RUBY
+
+ app_file 'config/routes/external.rb', <<-RUBY
+ get ':controller/:action'
+ RUBY
+
+ controller :success, <<-RUBY
+ class SuccessController < ActionController::Base
+ def index
+ render :text => "success!"
+ end
+ end
+ RUBY
+
+ app 'development'
+ get '/success/index'
+ assert_equal 'success!', last_response.body
+ end
+
{"development" => "baz", "production" => "bar"}.each do |mode, expected|
test "reloads routes when configuration is changed in #{mode}" do
controller :foo, <<-RUBY