1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

generate config.cache_classes = false if Spring

This commit is contained in:
Xavier Noria 2019-04-14 23:06:32 +02:00
parent 1e4b959c5e
commit 65344f254c
3 changed files with 21 additions and 5 deletions

View file

@ -1,3 +1,8 @@
* New applications get `config.cache_classes = false` in `config/environments/test.rb`
unless `--skip-spring`.
*Xavier Noria*
* Autoloading during initialization is deprecated.
*Xavier Noria*

View file

@ -1,11 +1,16 @@
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
<%# Spring executes the reloaders when files change. %>
<%- if spring_install? -%>
config.cache_classes = false
<%- else -%>
config.cache_classes = true
<%- end -%>
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that

View file

@ -827,6 +827,9 @@ class AppGeneratorTest < Rails::Generators::TestCase
def test_spring
run_generator
assert_gem "spring"
assert_file("config/environments/test.rb") do |contents|
assert_match("config.cache_classes = false", contents)
end
end
def test_bundler_binstub
@ -857,6 +860,9 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_no_file "config/spring.rb"
assert_no_gem "spring"
assert_file("config/environments/test.rb") do |contents|
assert_match("config.cache_classes = true", contents)
end
end
def test_spring_with_dev_option