aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/middleware_test.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2014-09-30 01:32:42 +0930
committerMatthew Draper <matthew@trebex.net>2015-07-09 02:23:23 +0930
commitc37d47e30897762145835e66ae752cce924af01d (patch)
tree1b615adf6030b9d77557c88a51497c432a2c58a8 /railties/test/application/middleware_test.rb
parentc2b5aa041b04e65475dd3ebb9f33a68b26e25895 (diff)
downloadrails-c37d47e30897762145835e66ae752cce924af01d.tar.gz
rails-c37d47e30897762145835e66ae752cce924af01d.tar.bz2
rails-c37d47e30897762145835e66ae752cce924af01d.zip
Soften the lock requirements when eager_load is disabled
We don't need to fully disable concurrent requests: just ensure that loads are performed in isolation.
Diffstat (limited to 'railties/test/application/middleware_test.rb')
-rw-r--r--railties/test/application/middleware_test.rb25
1 files changed, 21 insertions, 4 deletions
diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb
index ce92ebbf66..0ea2c57c55 100644
--- a/railties/test/application/middleware_test.rb
+++ b/railties/test/application/middleware_test.rb
@@ -121,23 +121,40 @@ module ApplicationTests
assert !middleware.include?("ActiveRecord::Migration::CheckPending")
end
- test "includes lock if cache_classes is set but eager_load is not" do
+ test "includes interlock if cache_classes is set but eager_load is not" do
add_to_config "config.cache_classes = true"
boot!
- assert middleware.include?("Rack::Lock")
+ assert_not_includes middleware, "Rack::Lock"
+ assert_includes middleware, "ActionDispatch::LoadInterlock"
+ end
+
+ test "includes lock if cache_classes is off" do
+ add_to_config "config.cache_classes = false"
+ boot!
+ assert_includes middleware, "Rack::Lock"
+ assert_not_includes middleware, "ActionDispatch::LoadInterlock"
end
test "does not include lock if cache_classes is set and so is eager_load" do
add_to_config "config.cache_classes = true"
add_to_config "config.eager_load = true"
boot!
- assert !middleware.include?("Rack::Lock")
+ assert_not_includes middleware, "Rack::Lock"
+ assert_not_includes middleware, "ActionDispatch::LoadInterlock"
end
test "does not include lock if allow_concurrency is set" do
add_to_config "config.allow_concurrency = true"
boot!
- assert !middleware.include?("Rack::Lock")
+ assert_not_includes middleware, "Rack::Lock"
+ assert_not_includes middleware, "ActionDispatch::LoadInterlock"
+ end
+
+ test "includes lock if allow_concurrency is disabled" do
+ add_to_config "config.allow_concurrency = false"
+ boot!
+ assert_includes middleware, "Rack::Lock"
+ assert_not_includes middleware, "ActionDispatch::LoadInterlock"
end
test "removes static asset server if serve_static_files is disabled" do