Skip to content

Commit 0337d17

Browse files
authored
When RAILS_ENV=test, always set cache to null_store
1 parent 91a5c9b commit 0337d17

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/graphql/fragment_cache/railtie.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@ def store=(store)
2626

2727
if ENV["RACK_ENV"] == "test" || ENV["RAILS_ENV"] == "test"
2828
initializer 'graphql-fragment_cache' do
29-
if Rails.version.to_f >= 7.0 && ::ActiveSupport::Cache.format_version < 7.0
29+
original_cache_version = if Rails.version.to_f >= 7.0 && ::ActiveSupport::Cache.format_version < 7.0
3030
cache_format_version = ::ActiveSupport::Cache.format_version
3131
::ActiveSupport::Cache.format_version = 7.0
32-
config.graphql_fragment_cache.store = :null_store
33-
::ActiveSupport::Cache.format_version = cache_format_version
32+
cache_format_version
3433
end
34+
35+
config.graphql_fragment_cache.store = :null_store
36+
37+
::ActiveSupport::Cache.format_version = original_cache_version if original_cache_version
3538
end
3639
end
3740
end

0 commit comments

Comments
 (0)