Skip to content

Commit

Permalink
Reinstate require_dependency
Browse files Browse the repository at this point in the history
The attempt at `require` caused a regression in new Rails apps (refs #47).
  • Loading branch information
trptcolin committed Oct 22, 2018
1 parent 0615350 commit d485ef2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/consistency_fail/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def preload_all
self.dirs.each do |d|
ruby_files = Dir.glob(File.join(d, "**", "*.rb")).sort
ruby_files.each do |model_filename|
Kernel.require model_filename
Kernel.require_dependency model_filename
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/models_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def models(load_path)
with(File.join("some/other/models", "**", "*.rb")).
and_return(["some/other/models/foo.rb"])

expect(Kernel).to receive(:require).with("app/models/user.rb")
expect(Kernel).to receive(:require).with("app/models/address.rb")
expect(Kernel).to receive(:require).with("some/other/models/foo.rb")
expect(Kernel).to receive(:require_dependency).with("app/models/user.rb")
expect(Kernel).to receive(:require_dependency).with("app/models/address.rb")
expect(Kernel).to receive(:require_dependency).with("some/other/models/foo.rb")

models.preload_all
end
Expand Down

0 comments on commit d485ef2

Please sign in to comment.