rspec / rspec-support

Common code needed by the other RSpec gems. Not intended for direct use.
https://rspec.info
MIT License
96 stars 104 forks source link

Remove `WithKeywordsWhenNeeded` #476

Open JonRowe opened 3 years ago

JonRowe commented 3 years ago

My approach to try to split args and use **kwargs for delegation is incorrect and needs to be phased out in 3.x and this module removed in 4.x. The problem is that arguments that implement to_hash are wrongly detected (with no way to know they are not) and converted. Only ruby2_keywords delegation is safe.

See https://github.com/rspec/rspec-expectations/issues/1241 as an example of this issue.

pirj commented 3 years ago

A WIP attempt to get rid of WKWN in rspec-core https://github.com/rspec/rspec-core/commit/684b58411467aa551f00f0963de4276b8105eabf

I've been running it on Ruby 3.0, and the spec fails with something like foo: keyword missing for those lines where we pass a hash:

include_examples "...", { foo: "..." }