-
-
Notifications
You must be signed in to change notification settings - Fork 358
Reproduction case for Ruby 3.2 and kwargs detection #1497
Conversation
@eregon Do you happen to know what might have caused the failures on 3.2.0-preview2 and ruby-head while passed just fine with 3.1? Is this still correct for Ruby 3.2? if RSpec::Support::RubyFeatures.distincts_kw_args_from_positional_hash? && expected_args == actual_args
expected_hash = expectation.expected_args.last
actual_hash = args_for_multiple_calls.last.last
if Hash === expected_hash && Hash === actual_hash &&
(Hash.ruby2_keywords_hash?(expected_hash) != Hash.ruby2_keywords_hash?(actual_hash))
actual_args += Hash.ruby2_keywords_hash?(actual_hash) ? " (keyword arguments)" : " (options hash)"
expected_args += Hash.ruby2_keywords_hash?(expected_hash) ? " (keyword arguments)" : " (options hash)"
end
end 2.2 failure is unrelated, to be fixed by #1498 |
expect(dbl).to receive(:kw_args_method).with({a: 1, b: 2}) | ||
dbl.kw_args_method(a: 1, b: 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this expected to fail? It expects a positional Hash but is given kwargs.
But I guess expect(dbl).to receive
actually creates a method with no kwargs so then it should pass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indeed should have failed on earlier Ruby versions, too.
That code looks fine. I suspect it's a missing |
And 3.2 fixes a bug where some missing |
Thank you so much for the explanation, @eregon ! |
Superseded by #1514 |
Related to #1495