Skip to content

Sinject::Container#register allows key parameter to be nil #14

@KevinBrowne

Description

@KevinBrowne

Sinject::Container#register will check that a key parameter has been provided and raise an error if it is absent. However, it does not check that the key is non-nil.

Steps to reproduce:

require 'sinject'
container = Sinject::Container.new(false)
container.register(key: nil, class: Object)

Expected:

Sinject::DependencyRegistrationKeyNotSpecifiedException or similar to be raised.

Actual:

  • Nothing is raised.

  • container.get(nil) returns an instance of Object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions