Skip to content

Commit

Permalink
Merge pull request #38269 from jorgemanrubia/cache-view-templates-in-…
Browse files Browse the repository at this point in the history
…tests

Cache compiled view templates when running tests by default
  • Loading branch information
kaspth committed Jan 21, 2020
1 parent 11a7e3f commit 77aea57
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions railties/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
* Cache compiled view templates when running tests by default

When generating a new app without `--skip-spring`, caching classes is
disabled in `environments/test.rb`. This implicitly disables caching
view templates too. This change will enable view template caching by
adding this to the generated `environments/test.rb`:

````ruby
config.action_view.cache_template_loading = true
````

*Jorge Manrubia*

* `Rails::Application#eager_load!` is available again to load application code
manually as it was possible in previous versions.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Rails.application.configure do
<%-# Spring executes the reloaders when files change. %>
<%- if spring_install? -%>
config.cache_classes = false
config.action_view.cache_template_loading = true
<%- else -%>
config.cache_classes = true
<%- end -%>
Expand Down
1 change: 1 addition & 0 deletions railties/test/generators/app_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ def test_spring
assert_gem "spring"
assert_file("config/environments/test.rb") do |contents|
assert_match("config.cache_classes = false", contents)
assert_match("config.action_view.cache_template_loading = true", contents)
end
end

Expand Down

0 comments on commit 77aea57

Please sign in to comment.