Skip to content

Instantly share code, notes, and snippets.

@teddevaal
Last active August 29, 2015 14:16
Show Gist options
  • Save teddevaal/d8cf62112442456fa3a0 to your computer and use it in GitHub Desktop.
Save teddevaal/d8cf62112442456fa3a0 to your computer and use it in GitHub Desktop.
Rspec caching
spec/features/awesome_cache_sweeper_spec.rb
it 'expires the awesome cache', :with_caching do
perform_your_caching_method
end
spec_helper.rb
config.around(:each, :with_caching) do |spec|
ActionController::Base.perform_caching = true
ActionController::Base.cache_store = :file_store, 'tmp/cache'
spec.run
Rails.cache.clear
ActionController::Base.perform_caching = false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment