提交 e8eb68c1 编写于 作者: J José Valim

Fix failure on middleware/exceptions_test

The reason the test was failing was because when the test
invokes `app.config`, the app is loaded and, as `eager_load`
is set to true, it disables the dependency loading mechanism,
so controllers that are later defined are not loaded.
上级 16fbe6f3
...@@ -91,7 +91,7 @@ module Finisher ...@@ -91,7 +91,7 @@ module Finisher
# Disable dependency loading during request cycle # Disable dependency loading during request cycle
initializer :disable_dependency_loading do initializer :disable_dependency_loading do
if config.eager_load if config.eager_load && config.cache_classes
ActiveSupport::Dependencies.unhook! ActiveSupport::Dependencies.unhook!
end end
end end
......
...@@ -88,9 +88,6 @@ def index ...@@ -88,9 +88,6 @@ def index
end end
test "displays diagnostics message when exception raised in template that contains UTF-8" do test "displays diagnostics message when exception raised in template that contains UTF-8" do
app.config.action_dispatch.show_exceptions = true
app.config.consider_all_requests_local = true
controller :foo, <<-RUBY controller :foo, <<-RUBY
class FooController < ActionController::Base class FooController < ActionController::Base
def index def index
...@@ -98,18 +95,15 @@ def index ...@@ -98,18 +95,15 @@ def index
end end
RUBY RUBY
app.config.action_dispatch.show_exceptions = true
app.config.consider_all_requests_local = true
app_file 'app/views/foo/index.html.erb', <<-ERB app_file 'app/views/foo/index.html.erb', <<-ERB
<% raise 'boooom' %> <% raise 'boooom' %>
✓測試テスト시험 ✓測試テスト시험
ERB ERB
app_file 'config/routes.rb', <<-RUBY get '/foo', :utf8 => '✓'
AppTemplate::Application.routes.draw do
post ':controller(/:action)'
end
RUBY
post '/foo', :utf8 => '✓'
assert_match(/boooom/, last_response.body) assert_match(/boooom/, last_response.body)
assert_match(/測試テスト시험/, last_response.body) assert_match(/測試テスト시험/, last_response.body)
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册