Sha256: 21db84fd0e1f0fa45115e936d3ec1c5adfebfee4f7723b3a71b49c50cd980150
Contents?: true
Size: 795 Bytes
Versions: 2
Compression:
Stored size: 795 Bytes
Contents
require "dry/component/container" RSpec.describe Dry::Component::Container, ".injector" do context "injector_options provided" do it "builds an injector with the provided options" do Test::Foo = Class.new Test::Container = Class.new(Dry::Component::Container) do register "foo", Test::Foo.new end Test::Inject = Test::Container.injector(strategies: { default: Dry::AutoInject::Strategies::Args, australian: Dry::AutoInject::Strategies::Args }) injected_class = Class.new do include Test::Inject.australian["foo"] end obj = injected_class.new expect(obj.foo).to be_a Test::Foo another = Object.new obj = injected_class.new(another) expect(obj.foo).to eq another end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-component-0.4.3 | spec/unit/container/injector_spec.rb |
dry-component-0.4.2 | spec/unit/container/injector_spec.rb |