From 55b560563423fcd4ab86ffc0cecb480f7297028f Mon Sep 17 00:00:00 2001 From: Cosima Radu Date: Thu, 11 Apr 2024 17:29:03 +0100 Subject: [PATCH] revert PR 35 --- lib/sinject/container.rb | 2 +- spec/sinject/container_spec.rb | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) 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