Skip to content

ruby 3.0: fixes the dreaded 'wrong number of arguments (given 1, expected 0)' error. #725

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

Merged
merged 1 commit into from
Aug 10, 2021
Merged
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
4 changes: 2 additions & 2 deletions lib/apipie/extractor/recorder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ def analyze(env, &block)
end

module FunctionalTestRecording
def process(*args) # action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
ret = super(*args)
def process(*, **) # action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it better to use

def process(*args, **kargs)
  ret = super
  # ...
end

?

Copy link
Contributor Author

@robmathews robmathews Aug 9, 2021

Choose a reason for hiding this comment

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

You can. I see both in the rails core. I mean, I literally read the rails source and copied the signature from there, but I don't actually have a strong opinion one way or the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it would make you accept the PR, I'll change it ...

Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind, seems OK.

ret = super
if Apipie.configuration.record
Apipie::Extractor.call_recorder.analyze_functional_test(self)
Apipie::Extractor.call_finished
Expand Down