FAQ / knapsack_pro / Common problems & solutions for knapsack_pro gem usage

When Ruby/RSpec tests fail with error like ActiveRecord::SubclassNotFound: Invalid single-table inheritance type: AuthenticationProviders::AnAuthenticationProvider

If your Ruby tests (RSpec tests) fail with an error similar to below while running tests with knapsack_pro gem:


ActiveRecord::SubclassNotFound:
Invalid single-table inheritance type: AuthenticationProviders::AnAuthenticationProvider is not a subclass of AuthenticationProvider

The above error has something to do with files that are changing during the execution of tests.

You need to ensure to load your classes only once in the test environment for a Rails project to fix the problem.


# environments/test.rb
config.eager_load = true

This should fix the problem for both knapsack_pro Regular Mode and Queue Mode.

Start using Knapsack Pro

Sign up and speed up your tests.