Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Implement granular expectations for method signatures #250

Merged
merged 5 commits into from
May 25, 2016
Merged

Implement granular expectations for method signatures #250

merged 5 commits into from
May 25, 2016

Conversation

sleepingkingstudios
Copy link
Contributor

Supports rspec/rspec-expectations#846.

Allows MethodSignatureVerifier to verify:

  • Heterogenous min and max arguments counts (e.g. functions with optional arguments).
  • Optional and/or required keyword arguments if supported by Ruby runtime.
  • Splatted arguments and/or keyword arguments.

For an example of use, see https://github.com/rspec/rspec-expectations/compare/master...sleepingkingstudios:respond_to-keyword-arguments?expand=1

@@ -26,9 +26,13 @@ def non_kw_args_arity_description
end
end

def valid_non_kw_args?(positional_arg_count)
def valid_non_kw_args?(positional_arg_count, optional_max_arg_count=nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to set the default for optional_max_arg_count to positional_arg_count which should eliminate the ||= below.

@JonRowe JonRowe merged commit ce33258 into rspec:master May 25, 2016
@JonRowe
Copy link
Member

JonRowe commented May 25, 2016

thanks! merging despite build failure as it's a known bundler issue

JonRowe added a commit that referenced this pull request May 26, 2016
JonRowe added a commit that referenced this pull request Jun 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants