You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you specify a contract class, Sinject::Container#register will verify that the methods of the provided class accept parameters with the same names as in the contract. However, it does not check that positional parameters are in the correct order.
Steps to reproduce:
require'sinject'container=Sinject::Container.new(false)classMyContractdeffamily_then_given(given_name,family_name)=nilendclassBadImpldeffamily_then_given(given_name,surname)="#{surname}, #{given_name}"endcontainer.register(key: :concatenator,class: BadImpl,contract: MyContract)# => Sinject::DependencyContractInvalidParametersException# The method signature of method: 'family_then_given' does not match the contract parameters: 'family_name, surname'classOutOfOrderImpldeffamily_then_given(family_name,given_name)="#{family_name}, #{given_name}"endcontainer.register(key: :concatenator,class: OutOfOrderImpl,contract: MyContract)
Expected:
Sinject::DependencyContractInvalidParametersException or similar error to be raised
Actual:
OutOfOrderImpl is considered to match the contract and is registered.
If you specify a contract class,
Sinject::Container#register
will verify that the methods of the provided class accept parameters with the same names as in the contract. However, it does not check that positional parameters are in the correct order.Steps to reproduce:
Expected:
Sinject::DependencyContractInvalidParametersException
or similar error to be raisedActual:
OutOfOrderImpl
is considered to match the contract and is registered.The text was updated successfully, but these errors were encountered: