diff options
author | José Valim <jose.valim@gmail.com> | 2010-09-02 12:54:16 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-02 12:54:21 +0200 |
commit | 48bf667a8b1c489bd6edff0b8322324a7a1b06bc (patch) | |
tree | 0abae7b918253749988d4e575b31e405e41dfac7 /railties/test/application | |
parent | 38a421b34d0b414564e919f67d339fac067a56e6 (diff) | |
download | rails-48bf667a8b1c489bd6edff0b8322324a7a1b06bc.tar.gz rails-48bf667a8b1c489bd6edff0b8322324a7a1b06bc.tar.bz2 rails-48bf667a8b1c489bd6edff0b8322324a7a1b06bc.zip |
Ensure routes are loaded only after the initialization process finishes, ensuring all configuration options were applied.
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/routing_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/railties/test/application/routing_test.rb b/railties/test/application/routing_test.rb index febc53bac9..53bb7868da 100644 --- a/railties/test/application/routing_test.rb +++ b/railties/test/application/routing_test.rb @@ -215,6 +215,23 @@ module ApplicationTests end end + test 'routes are loaded just after initialization' do + require "#{app_path}/config/application" + + ActiveSupport.on_load(:after_initialize) do + ::InitializeRackApp = lambda { |env| [200, {}, ["InitializeRackApp"]] } + end + + app_file 'config/routes.rb', <<-RUBY + AppTemplate::Application.routes.draw do |map| + match 'foo', :to => ::InitializeRackApp + end + RUBY + + get '/foo' + assert_equal "InitializeRackApp", last_response.body + end + test 'resource routing with irrigular inflection' do app_file 'config/initializers/inflection.rb', <<-RUBY ActiveSupport::Inflector.inflections do |inflect| |