-
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix exact match on ActionController::Parameters
This was broken in this previous commit [1] which was part of #660 and which was released in v2.4.3. Previously the only requirement we put on `Hash`-like arguments was that they respond to `#keys` & `#[]` methods. However, the change in [1] we introduced an implicit assumption that they also respond to a `#length` method which is caused the problem described here [2]. However, `ActionController::Parameters` [3] is commonly used in Rails apps and it does *not* respond to `#length`. So it seems better to add a guard condition to ensure the object responds to `#keys` and use that to determine the length. Note that the `HasEntry`, `HasKey` and `HasKeys` matchers already work this way and so this feels like it makes `HasEntries` more consistent. [1]: 5e6a07b [2]: #662 (comment) [3]: https://api.rubyonrails.org/classes/ActionController/Parameters.html
- Loading branch information
1 parent
0e2b73c
commit 228acc9
Showing
3 changed files
with
37 additions
and
1 deletion.
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
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