Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KevinBrowne opened this issue Feb 21, 2024 · 0 comments
Open

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

KevinBrowne opened this issue Feb 21, 2024 · 0 comments
Labels

Comments

@KevinBrowne
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant