Sha256: 6fc284a8336163da211f106d6a86d3bc1a1c45b61251662d764446d537b3c2f8

Contents?: true

Size: 735 Bytes

Versions: 4

Compression:

Stored size: 735 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

4 entries across 4 versions & 2 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/dry-container-0.7.2/spec/integration/mixin_spec.rb
dry-container-0.7.2 spec/integration/mixin_spec.rb
dry-container-0.7.1 spec/integration/mixin_spec.rb
dry-container-0.7.0 spec/integration/mixin_spec.rb