Created
June 6, 2024 22:36
-
-
Save joekrump/c294e8afd0d9dfb798ed4b8e7d7813e9 to your computer and use it in GitHub Desktop.
RSpec enable cache conditional on meta data
This file contains 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
# allow cache to be used in a test that uses the :with_cache metadata | |
config.around do |example| | |
if example.metadata[:with_cache] | |
Rails.cache = ActiveSupport::Cache.lookup_store(:memory_store) | |
Rails.cache.clear | |
end | |
example.run | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment