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.

Fix

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)
Emanuel De about 1 year ago
This website uses short-lived cookies to improve usability.
Accept or learn more