Closed pirj closed 1 year ago
@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
That code looks fine. I suspect it's a missing ruby2_keywords
on the chain of calls, and so the flag is lost somewhere.
You can debug by printing Hash.ruby2_keywords_hash?(h)
before the exception happens.
And 3.2 fixes a bug where some missing ruby2_keywords
accidentally kept the flag: https://github.com/ruby/ruby/blob/master/NEWS.md
Thank you so much for the explanation, @eregon !
Superseded by #1514
Related to #1495