Last active
September 28, 2015 23:08
-
-
Save rossta/1510261 to your computer and use it in GitHub Desktop.
Set controller caching in RSpec around block
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
| RSpec.configure do |config| | |
| config.around(:each, :caching) do |example| | |
| caching = ActionController::Base.perform_caching | |
| ActionController::Base.perform_caching = example.metadata[:caching] | |
| example.run | |
| Rails.cache.clear | |
| ActionController::Base.perform_caching = caching | |
| end | |
| end |
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
| describe "visit the homepage", :caching => true do | |
| // test cached stuff | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment