Skip to content

Instantly share code, notes, and snippets.

@rossta
Last active September 28, 2015 23:08
Show Gist options
  • Select an option

  • Save rossta/1510261 to your computer and use it in GitHub Desktop.

Select an option

Save rossta/1510261 to your computer and use it in GitHub Desktop.
Set controller caching in RSpec around block
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
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