Search code examples
ruby-on-railsfunctional-testingpage-caching

How to enable page caching in a functional test in rails?


Is it possible to turn on page caching for a functional test? The following didn't work:

class ArticlesControllerTest < ActionController::TestCase
 def setup
    ActionController::Base.public_class_method :page_cache_path
    ActionController::Base.perform_caching = true
 end
end

thanks in advance

Deb


Solution

  • I couldn't figure out why this was not working, so I ended up enabling caching directly on environments/test.rb:

    config.action_controller.perform_caching             = true