diff options
author | st0012 <stan001212@gmail.com> | 2019-04-19 22:50:42 +0900 |
---|---|---|
committer | st0012 <stan001212@gmail.com> | 2019-04-19 22:50:42 +0900 |
commit | 7814d1c0ae63428fecc3df79bec3903a6e8857d0 (patch) | |
tree | 5f61769eda6151b789dee08e39595d7a451db406 /railties/test/application | |
parent | 16dae7684edc480ee3fe65dfff8e19989402c987 (diff) | |
download | rails-7814d1c0ae63428fecc3df79bec3903a6e8857d0.tar.gz rails-7814d1c0ae63428fecc3df79bec3903a6e8857d0.tar.bz2 rails-7814d1c0ae63428fecc3df79bec3903a6e8857d0.zip |
Make sure api controllers can perform caching as well
Currently ActionController::API doesn't include Caching module, so it
can't perform caching. And even if users include it later manually, it
won't inherit application's default cache store for action_controllers.
So the only way to solve this issue is to include Caching module in
ActionController::API, too.
This closes #35602
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/configuration_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 62d9b1c813..0ddf299875 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -2216,6 +2216,19 @@ module ApplicationTests assert_equal :default, Rails.configuration.debug_exception_response_format end + test "action_controller.cache_store works for api_only app as well" do + add_to_config <<-RUBY + config.api_only = true + config.action_controller.cache_store = :memory_store + RUBY + + app "development" + + api_controller = Class.new(ActionController::API) + + assert_equal(api_controller.cache_store.class, ActiveSupport::Cache::MemoryStore) + end + test "controller force_ssl declaration can be used even if session_store is disabled" do make_basic_app do |application| application.config.session_store :disabled |