From f30fa29994e0b650e86f6a2d4a0216d82d95cb36 Mon Sep 17 00:00:00 2001 From: Julian Herrero Date: Thu, 28 Mar 2024 13:45:06 +0100 Subject: [PATCH] Allow running specs scenarios using the Rails cache Cache is by default disabled on every non-production environment --- spec/spec_helper.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a82d425e6..15c49772e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -193,6 +193,11 @@ RSpec.configure do |config| savon.unmock! end + config.before(:each, :with_cache) do + allow(Rails).to receive(:cache).and_return(ActiveSupport::Cache.lookup_store(:memory_store)) + Rails.cache.clear + end + # Allows RSpec to persist some state between runs in order to support # the `--only-failures` and `--next-failure` CLI options. config.example_status_persistence_file_path = "spec/examples.txt"