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

Add support for `.call` to WithKeywordsWhenNeeded #475

Closed pirj closed 3 years ago

pirj commented 3 years ago

Needed for rspec-mocks

https://github.com/rspec/rspec-mocks/issues/1306

This is based on https://github.com/rspec/rspec-mocks/pull/1324/files#diff-afc11368b62c27a5bd155b766ec9cf4e96a9331d073b6123a9bce36a270de640R359

JonRowe commented 3 years ago

This is the wrong approach, this class actually needs to be removed in RSpec 4. My approach using the helper class is the cause of the to_hash issues caused elsewhere, there is no way to determine between a hashlike object and keywords being passed through.

pirj commented 3 years ago

WithKeywordsWhenNeeded bothers me as well.

I haven't managed to rewrite rspec-core's lib/rspec/core/shared_example_group.rb with it. Can you take the lead and get rid of it there? I can mimic the fix for rspec-mocks then.