-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert eager_load option in Container#finalize! (fix #281)"
This reverts commit 7b8ae92.
- Loading branch information
1 parent
ddb8d29
commit b96e64c
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
spec/integration/container/auto_registration/eager_loading_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe "Eager loading during finalization" do | ||
it "raises error when component cannot be found, due to missing inflection" do | ||
class Test::Container < Dry::System::Container | ||
configure do |config| | ||
config.root = SPEC_ROOT.join("fixtures").realpath | ||
|
||
config.component_dirs.add "components" do |dir| | ||
dir.namespaces.add "test", key: nil | ||
end | ||
end | ||
end | ||
expect { Test::Container.finalize! }.to raise_error(Dry::System::ComponentNotLoadableError) | ||
end | ||
|
||
it "does not raise error when constant can be found" do | ||
class Test::Container < Dry::System::Container | ||
configure do |config| | ||
config.root = SPEC_ROOT.join("fixtures").realpath | ||
|
||
config.component_dirs.add "components" do |dir| | ||
dir.namespaces.add "test", key: nil | ||
end | ||
|
||
config.inflector = Dry::Inflector.new { |i| i.acronym("ABC") } | ||
end | ||
end | ||
expect { Test::Container.finalize! }.to_not raise_error | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters