aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-10-03 14:21:31 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-10-03 14:21:31 -0700
commit24f9c03d52ad4c7f081cc7a9561946109b3ad500 (patch)
tree32545119b6321671e890e5c8139bbbf99729430f /railties/test
parent99392112c5367f0556225fd84f9e41da88e3277e (diff)
downloadrails-24f9c03d52ad4c7f081cc7a9561946109b3ad500.tar.gz
rails-24f9c03d52ad4c7f081cc7a9561946109b3ad500.tar.bz2
rails-24f9c03d52ad4c7f081cc7a9561946109b3ad500.zip
Revert "removing Rack::Runtime from the default stack."
This reverts commit 37423e4ff883ad5584bab983aceb4b2b759a1fd8. Jeremy is right that we shouldn't remove this. The fact is that many engines are depending on this middleware to be in the default stack. This ties our hands and forces us to keep the middleware in the stack so that engines will work. To be extremely clear, I think this is another smell of "the rack stack" that we have in place. When manipulating middleware, we should have meaningful names for places in the req / res lifecycle **not** have engines depend on a particular constant be in a particular place in the stack. This is a weakness of the API that we have to figure out a way to address before removing the constant. As far as timing attacks are concerned, we can reduce the granularity such that it isn't useful information for hackers, but is still useful for developers.
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/middleware_test.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb
index 490f0ba822..138c63266e 100644
--- a/railties/test/application/middleware_test.rb
+++ b/railties/test/application/middleware_test.rb
@@ -27,8 +27,9 @@ module ApplicationTests
"Rack::Sendfile",
"ActionDispatch::Static",
"ActionDispatch::LoadInterlock",
- "Rack::MethodOverride",
"ActiveSupport::Cache::Strategy::LocalCache",
+ "Rack::Runtime",
+ "Rack::MethodOverride",
"ActionDispatch::RequestId",
"Rails::Rack::Logger", # must come after Rack::MethodOverride to properly log overridden methods
"ActionDispatch::ShowExceptions",
@@ -58,6 +59,7 @@ module ApplicationTests
"ActionDispatch::Static",
"ActionDispatch::LoadInterlock",
"ActiveSupport::Cache::Strategy::LocalCache",
+ "Rack::Runtime",
"ActionDispatch::RequestId",
"Rails::Rack::Logger", # must come after Rack::MethodOverride to properly log overridden methods
"ActionDispatch::ShowExceptions",
@@ -166,19 +168,19 @@ module ApplicationTests
end
test "can delete a middleware from the stack even if insert_before is added after delete" do
- add_to_config "config.middleware.delete ActionDispatch::ShowExceptions"
- add_to_config "config.middleware.insert_before(ActionDispatch::ShowExceptions, Rack::Config)"
+ add_to_config "config.middleware.delete Rack::Runtime"
+ add_to_config "config.middleware.insert_before(Rack::Runtime, Rack::Config)"
boot!
assert middleware.include?("Rack::Config")
- assert_not middleware.include?("ActionDispatch::ShowExceptions")
+ assert_not middleware.include?("Rack::Runtime")
end
test "can delete a middleware from the stack even if insert_after is added after delete" do
- add_to_config "config.middleware.delete ActionDispatch::ShowExceptions"
- add_to_config "config.middleware.insert_after(ActionDispatch::ShowExceptions, Rack::Config)"
+ add_to_config "config.middleware.delete Rack::Runtime"
+ add_to_config "config.middleware.insert_after(Rack::Runtime, Rack::Config)"
boot!
assert middleware.include?("Rack::Config")
- assert_not middleware.include?("ActionDispatch::ShowExceptions")
+ assert_not middleware.include?("Rack::Runtime")
end
test "includes exceptions middlewares even if action_dispatch.show_exceptions is disabled" do
@@ -216,12 +218,12 @@ module ApplicationTests
test "Rails.cache does not respond to middleware" do
add_to_config "config.cache_store = :memory_store"
boot!
- assert_equal "Rack::MethodOverride", middleware.fourth
+ assert_equal "Rack::Runtime", middleware.fourth
end
test "Rails.cache does respond to middleware" do
boot!
- assert_equal "ActiveSupport::Cache::Strategy::LocalCache", middleware.fifth
+ assert_equal "Rack::Runtime", middleware.fifth
end
test "insert middleware before" do