Posted about 1 year ago. Visible to the public.

Rails: Removing the cucumber-rails warning when setting cache_classes to false without Spring enabled

We are using Spring in our tests for sequential test execution but not for parallel test execution. And Rails requires you to set the config.cache_classes = false if you are using Spring in tests.

With our setup, this would raise the following error in cucumber-rails Archive for parallel test executions due to some legacy database cleaner issue.

WARNING: You have set Rails' config.cache_classes to false (Spring needs cache_classes set to false). This is known to cause problems with database transactions. Set config.cache_classes to true if you want to use transactions.


You need to upgrade to cucumber-rails >= 2.1.0 and adjust the config.cache_classes in config/environments/test.rb like below:

config.cache_classes = !defined?(Spring)

Your development team has a full backlog of feature requests, chores and refactoring coupled with deadlines? We are familiar with that. With our "DevOps as a Service" offering, we support developer teams with infrastructure and operations expertise.

Owner of this card:

Emanuel De
Last edit:
about 1 year ago
by Bruno Sedler
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Emanuel De to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more