Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 7.1 deprecation notice for cache_format_version in Rails test environment #114

Open
asgeo1 opened this issue May 9, 2024 · 0 comments

Comments

@asgeo1
Copy link

asgeo1 commented May 9, 2024

This line of code in this gem, is producing a deprecation warning with Rails 7.1

config.graphql_fragment_cache.store = :null_store

But only in the test environment.

DEPRECATION WARNING: Support for `config.active_support.cache_format_version = 6.1` has been deprecated and will be removed in Rails 7.2

It doesn't matter if you set config.active_support.cache_format_version = 7.1 in the Rails environment or intializer, the deprecation warning will still happen.

This is because that line of code is executing before Rails gets a chance to boot and set the correct cache_format_version.

If using RSpec, a possible workaround for now, is in rails_helper.rb to set the cache format version prior to the gem being loaded. e.g.

require "spec_helper"

# NOTE: this is a fix for graphql-fragment_cache, which is initializing it's own cache in the test environment
require "active_support/cache"
ActiveSupport::Cache.format_version = 7.1

require File.expand_path("../config/environment", __dir__)
require "rspec/rails"

RSpec.configure do |config|
  ...
@asgeo1 asgeo1 changed the title Rails 7.1 deprecation notice for cache_format_version Rails 7.1 deprecation notice for cache_format_version in Rails test environment May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant