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

Add static_cache_control as configuration option and set a default for test. Should improve performance in acceptance tests.

This commit is contained in:
José Valim 2011-05-03 13:07:39 +02:00
parent 06ddda0a5f
commit 1ca81238b5
3 changed files with 8 additions and 3 deletions

View file

@ -152,7 +152,7 @@ module Rails
end
if config.serve_static_assets
middleware.use ::ActionDispatch::Static, paths["public"].first
middleware.use ::ActionDispatch::Static, paths["public"].first, config.static_cache_control
end
middleware.use ::Rack::Lock unless config.allow_concurrency

View file

@ -9,7 +9,7 @@ module Rails
:dependency_loading, :encoding, :filter_parameters,
:force_ssl, :helpers_paths, :logger, :preload_frameworks,
:reload_plugins, :secret_token, :serve_static_assets,
:session_options, :time_zone, :whiny_nils
:static_cache_control, :session_options, :time_zone, :whiny_nils
attr_writer :log_level
@ -22,6 +22,7 @@ module Rails
@helpers_paths = []
@dependency_loading = true
@serve_static_assets = true
@static_cache_control = nil
@force_ssl = false
@session_store = :cookie_store
@session_options = {}

View file

@ -7,7 +7,11 @@
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Log error messages when you accidentally call methods on nil.
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
# Log error messages when you accidentally call methods on nil
config.whiny_nils = true
# Show full error reports and disable caching