spec/support/app_integration.rb in hanami-2.0.0.beta4 vs spec/support/app_integration.rb in hanami-2.0.0.rc1
- old
+ new
@@ -22,22 +22,14 @@
RSpec.shared_context "Application integration" do
let(:app_modules) { %i[TestApp Admin Main Search] }
end
def autoloaders_teardown!
- # Tear down Zeitwerk (from zeitwerk's own test/support/loader_test)
- Zeitwerk::Registry.loaders.reject! do |loader|
- test_loader = loader.dirs.any? { |dir|
+ ObjectSpace.each_object(Zeitwerk::Loader) do |loader|
+ loader.unregister if loader.dirs.any? { |dir|
dir.include?("/spec/") || dir.include?(Dir.tmpdir) ||
dir.include?("/slices/") || dir.include?("/app")
}
-
- if test_loader
- loader.unregister
- true
- else
- false
- end
end
end
RSpec.configure do |config|
config.include RSpec::Support::Files, :app_integration