diff options
author | Xavier Noria <fxn@hashref.com> | 2013-06-06 23:04:26 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2013-06-06 23:11:00 +0200 |
commit | b9b06daa915fdc4d11e8cfe11a7175e5cd8f104f (patch) | |
tree | 45c1bceec05b185b87dc0cf811d57a64dcc03850 /railties/test | |
parent | de3bd35806192ae6fa2e66e24ee1b5d462e30812 (diff) | |
download | rails-b9b06daa915fdc4d11e8cfe11a7175e5cd8f104f.tar.gz rails-b9b06daa915fdc4d11e8cfe11a7175e5cd8f104f.tar.bz2 rails-b9b06daa915fdc4d11e8cfe11a7175e5cd8f104f.zip |
clearing autoloaded constants triggers routes reloading [Fixes #10685]
Conflicts:
railties/test/application/loading_test.rb
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/loading_test.rb | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/railties/test/application/loading_test.rb b/railties/test/application/loading_test.rb index 96aa35b678..17926ac444 100644 --- a/railties/test/application/loading_test.rb +++ b/railties/test/application/loading_test.rb @@ -179,7 +179,7 @@ class LoadingTest < ActiveSupport::TestCase RUBY app_file 'config/routes.rb', <<-RUBY - $counter = 0 + $counter ||= 0 Rails.application.routes.draw do get '/c', to: lambda { |env| User; [200, {"Content-Type" => "text/plain"}, [$counter.to_s]] } end @@ -205,6 +205,39 @@ class LoadingTest < ActiveSupport::TestCase assert_equal "2", last_response.body end + test "dependencies reloading is followed by routes reloading" do + add_to_config <<-RUBY + config.cache_classes = false + RUBY + + app_file 'config/routes.rb', <<-RUBY + $counter ||= 1 + $counter *= 2 + AppTemplate::Application.routes.draw do + get '/c', to: lambda { |env| User; [200, {"Content-Type" => "text/plain"}, [$counter.to_s]] } + end + RUBY + + app_file "app/models/user.rb", <<-MODEL + class User + $counter += 1 + end + MODEL + + require 'rack/test' + extend Rack::Test::Methods + + require "#{rails_root}/config/environment" + + get "/c" + assert_equal "3", last_response.body + + app_file "db/schema.rb", "" + + get "/c" + assert_equal "7", last_response.body + end + test "columns migrations also trigger reloading" do add_to_config <<-RUBY config.cache_classes = false |