diff --git a/lib/sinject/container.rb b/lib/sinject/container.rb index a40f250..27c946d 100644 --- a/lib/sinject/container.rb +++ b/lib/sinject/container.rb @@ -163,7 +163,7 @@ def validate_contract(dependency_class, contract_class) def match?(contract, dependency) return true if contract[:type] == dependency[:type] return true if contract[:type] == :req && dependency[:type] == :opt - return true if [:keyreq, :keyrest].include?(contract[:type]) && dependency[:type] == :key + return true if contract[:type] == :keyreq && dependency[:type] == :key false end diff --git a/spec/sinject/container_spec.rb b/spec/sinject/container_spec.rb index 2ae364b..76ee1ea 100644 --- a/spec/sinject/container_spec.rb +++ b/spec/sinject/container_spec.rb @@ -333,9 +333,6 @@ def with_kwrest_args(foo, bar:, kwargs:); end context 'and the class specifies an optional keyword param of the same name' do it 'raises DependencyContractInvalidParametersException' do - pending('Bug: If the contract specifies keyrest params, '\ - 'the class should pass validation only if it also specifies keyrest args') - klass = Class.new do def with_kwrest_args(foo, bar:, kwargs: nil); end end