Sha256: 3b8ec0e5c5ebda86f33f4941fa8c1828f525a1b762277b45e5676753d3068927

Contents?: true

Size: 709 Bytes

Versions: 2

Compression:

Stored size: 709 Bytes

Contents

require 'dry/component/container'

RSpec.describe Dry::Component::Config do
  before do
    class Test::App < Dry::Component::Container
      configure do |config|
        config.name = :application
        config.root = SPEC_ROOT.join('fixtures/test').realpath
      end
    end

    class Test::SubApp < Dry::Component::Container
      configure do |config|
        config.name = :subapp
        config.root = SPEC_ROOT.join('fixtures/test').realpath
      end
    end
  end

  it 'loads config under component name' do
    expect(Test::App.options.foo).to eql('bar')
  end

  it 'allows different components to have different configurations' do
    expect(Test::SubApp.options.bar).to eql('baz')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-component-0.2.0 spec/unit/config_spec.rb
dry-component-0.1.0 spec/unit/config_spec.rb