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

Revert PR#35 #42

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/sinject/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions spec/sinject/container_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading