serpapi / turbo_tests

Run RSpec tests on multiple cores. Like parallel_tests but with incremental summarized output. Originally extracted from the Discourse and Rubygems source code.
https://rubygems.org/gems/turbo_tests
MIT License
173 stars 25 forks source link

Rails.application is nil in spec_helper.rb #22

Closed ibrahima closed 2 years ago

ibrahima commented 2 years ago

Hi! This is probably some quirk of our Rails setup, but for some reason when using turbo_tests Rails.application is nil inside our spec_helper.rb file. We normally do a Rails.application.eager_load! to help with simplecov code coverage stats, but this throws a nil error while using turbo_tests.

NoMethodError:
  undefined method `eager_load!' for nil:NilClass

I need to do more investigation of our init process to try and figure out why this is happening, but I wanted to ask here to see if anyone else has run into this or might have an idea why this would be different with turbo_tests vs a normal rspec run. Thank you!

I did see https://github.com/grosser/parallel_tests/issues/360 and so I tried running with DISABLE_SPRING=true but that doesn't seem to have helped.

Oh whoops! I realized now that the Rails application is not loaded in spec_helper but rails_helper in our application. Moving the eager load there fixed the problem! But I don't understand why it works when not using turbo_tests (or parallel_test also).