aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/configuration_test.rb
diff options
context:
space:
mode:
authorPrem Sichanugrist <s@sikac.hu>2019-03-23 16:47:26 +0900
committerPrem Sichanugrist <s@sikac.hu>2019-03-23 19:31:03 +0900
commitb27105252bce6a69f6d57c05d4ea28d20e84f8ae (patch)
tree13072d72ae90d7c83597b6c832799454aba13b75 /railties/test/application/configuration_test.rb
parentefb706daad0e2e1039c6abb4879c837ef8bf4d10 (diff)
downloadrails-b27105252bce6a69f6d57c05d4ea28d20e84f8ae.tar.gz
rails-b27105252bce6a69f6d57c05d4ea28d20e84f8ae.tar.bz2
rails-b27105252bce6a69f6d57c05d4ea28d20e84f8ae.zip
Add config.disable_sandbox option to Rails console
A long-running `rails console --sandbox` could cause a database server to become out-of-memory as it's holding on to changes that happen on the database. Given that it's common for Ruby on Rails application with huge traffic to have separate write database and read database, we should allow the developers to disable this sandbox option to prevent someone from accidentally causing the Denial-of-Service on their server.
Diffstat (limited to 'railties/test/application/configuration_test.rb')
-rw-r--r--railties/test/application/configuration_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index e34c075a1c..b8e167b488 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -2476,6 +2476,22 @@ module ApplicationTests
assert_includes Rails.application.config.hosts, ".localhost"
end
+ test "disable_sandbox is false by default" do
+ app "development"
+
+ assert_equal false, Rails.configuration.disable_sandbox
+ end
+
+ test "disable_sandbox can be overridden" do
+ add_to_config <<-RUBY
+ config.disable_sandbox = true
+ RUBY
+
+ app "development"
+
+ assert Rails.configuration.disable_sandbox
+ end
+
private
def force_lazy_load_hooks
yield # Tasty clarifying sugar, homie! We only need to reference a constant to load it.