title: Rails/RSpec toggle cache for a single test
body: <p>So in my app I can disable the cache for all tests, which would be ideal, but apparently there are a number of legacy tests that rely on the cache being functional. Is there a way to enable the Rails cache for a single RSpec test?</p>
  
  <p>Something like:</p>
  
  <pre><code>before(:each) do
    @cache_setting = Rails.cache.null_cache
    Rails.cache.null_cache = true
  end
  
  after(:each) do
    Rails.cache.null_cache = @cache_setting
  end
  
  it 'does not hit the cache' do
    ...
  end
  </code></pre>