When attempting to run spec/integration/app_spec.rb locally, the tests will fail if you already have Rails 7+ installed. This is because the tests assume you're testing with Rails 6 by default, but when the tests run rails new, it picks up the Rails 7 version. This results in the scaffolding being built out with Rails 7 features, and when the app is then run against Rails 6, it fails to boot because of references to those newer features.
The solution is to force rails new to reference the correct Rails version to use, e.g.
$ rails _6.1.7.2_ new ...
With this, rails new builds the correct scaffolding and the tests are able to pass.