Created
February 24, 2012 10:22
-
-
Save ches/1899982 to your computer and use it in GitHub Desktop.
ActionController caching context manager for testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Via raggi: http://stackoverflow.com/questions/5035982/optionally-testing-caching-in-rails-3-functional-tests | |
| module ActionController::Testing::Caching | |
| def with_caching(on = true) | |
| caching = ActionController::Base.perform_caching | |
| ActionController::Base.perform_caching = on | |
| yield | |
| ensure | |
| ActionController::Base.perform_caching = caching | |
| end | |
| def without_caching(&block) | |
| with_caching(false, &block) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment