diff --git a/lib/dry/system/container.rb b/lib/dry/system/container.rb index 1f9ba418..3afd7687 100644 --- a/lib/dry/system/container.rb +++ b/lib/dry/system/container.rb @@ -314,7 +314,7 @@ def finalized? # @return [self] frozen container # # @api public - def finalize!(freeze: true, eager_load: true, &) + def finalize!(freeze: true, &) return self if finalized? configured! @@ -324,8 +324,6 @@ def finalize!(freeze: true, eager_load: true, &) [providers, auto_registrar, manifest_registrar, importer].each(&:finalize!) - keys.each { resolve(_1) } if eager_load - @__finalized__ = true self.freeze if freeze diff --git a/spec/integration/container/auto_registration/eager_loading_spec.rb b/spec/integration/container/auto_registration/eager_loading_spec.rb deleted file mode 100644 index a7099712..00000000 --- a/spec/integration/container/auto_registration/eager_loading_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -# 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 diff --git a/spec/integration/container/auto_registration/memoize_spec.rb b/spec/integration/container/auto_registration/memoize_spec.rb index af051f82..5a96dfc6 100644 --- a/spec/integration/container/auto_registration/memoize_spec.rb +++ b/spec/integration/container/auto_registration/memoize_spec.rb @@ -17,8 +17,6 @@ class Test::Container < Dry::System::Container dir.namespaces.add "test", key: nil dir.memoize = true end - - config.inflector = Dry::Inflector.new { |i| i.acronym("ABC") } end end end @@ -54,8 +52,6 @@ class Test::Container < Dry::System::Container !component.key.match?(/bar/) end end - - config.inflector = Dry::Inflector.new { |i| i.acronym("ABC") } end end end diff --git a/spec/unit/container/configuration_spec.rb b/spec/unit/container/configuration_spec.rb index 5249e72f..c67a902e 100644 --- a/spec/unit/container/configuration_spec.rb +++ b/spec/unit/container/configuration_spec.rb @@ -175,29 +175,5 @@ def hooks_trace .from([]) .to [:after_configure] end - - it "raises error for undefined constant (due to inflector missing acronym)" do - expect { - 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 - container.finalize! - }.to raise_error(Dry::System::ComponentNotLoadableError) - end - - it "does not raises error for undefined constant when eager_load is false" do - expect { - 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 - container.finalize!(eager_load: false) - }.to_not raise_error - end end end