zeitwerk: Modules don't get autovivified

Dear maintainer,

I try to update our application to rails 6.0.3.3 which uses zeitwerk 2.4.2

I need to define

module Cache
end

additional to

module Cache
  class Base
  ...

to be able to execute the following spec

describe Cache::Base do
...

otherwise is raises an

Zeitwerk::NameError:
  expected file /usr/src/app/app/lib/cache.rb to define constant Cache, but didn't

My settings are:

[12] pry(main)> Rails.configuration.autoloader
=> :zeitwerk
[13] pry(main)> Rails.configuration.autoload_paths
=> ["/usr/src/app/previews", "/usr/src/app/app/components"]

The module should get autovivified, but it doesn’t. Any ideas? Thx! Best regards

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 29 (17 by maintainers)

Most upvoted comments

Does that mean that runner finds Cache::Base in development mode but the spec does not?