Sha256: d0861529471625562ca551c22e9ac3226451793236d9a2a6a36de9b4d309e091

Contents?: true

Size: 734 Bytes

Versions: 1

Compression:

Stored size: 734 Bytes

Contents

RSpec.describe Dry::Container::Mixin do
  describe 'extended' do
    let(:klass) do
      Class.new { extend Dry::Container::Mixin }
    end
    let(:container) { klass }

    it_behaves_like 'a container'
  end

  describe 'included' do
    let(:klass) do
      Class.new { include Dry::Container::Mixin }
    end
    let(:container) { klass.new }

    it_behaves_like 'a container'

    context 'into a class with a custom .initialize method' do
      let(:klass) do
        Class.new do
          include Dry::Container::Mixin
          def initialize; end
        end
      end

      it 'does not fail on missing member variable' do
        expect { container.register :key, ->{} }.to_not raise_error
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-container-0.6.0 spec/integration/mixin_spec.rb