This repository has been archived by the owner on Nov 30, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect Ruby 3's conversion from keywords to a positional last Hash
This change allows a Hash argument expectation (`with({ a: 'a' })`) to accept keyword arguments (`foo(a: 'a')`) both in Ruby 2 and in Ruby 3. ``` allow(foo).to receive(:bar).with({ a: 'a' }) foo.bar(a: 'a') foo.bar({ a: 'a' }) ``` This is because Ruby 3 also allows the automatic conversion from keywords to a positional Hash. (But the conversion from a positional last Hash to keywords is not allowed.) ``` def foo(opts = {}) end foo(a: 'a') foo({ a: 'a' }) ```
- Loading branch information
Showing
2 changed files
with
5 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters