I am using rack_cache to cache some of the responses withing Redis. I would like to test with rspec so I would be sure that caching works. I can do this with:
config.action_dispatch.rack_cache = true
The problem is because I would like to set this setting on single test, not for whole app.
For high level caching we can use around bock:
config.around(:each, :caching) do |example|
caching = ActionController::Base.perform_caching
ActionController::Base.perform_caching = example.metadata[:caching]
example.run
ActionController::Base.perform_caching = caching
end
Is there a way to do something similar for Rack cache?
I ended up deliting redis cache before running tests: