Change one policy fixture #192
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It's possible that my brain is breaking down the problem incorrectly, but here's why I think we should change this fixture:
Here's the existing fixture (laid out differently so that it more easily fits on one line in this tiny box)
Let's break this down. I think the first step is where our understandings diverge:
newslettershas a single element, and runningallon an array would grab each element in the array. For a map, it drops the keys and returns an array of the values. In this case, that would be the inner array (eachemailobject).I believe this behaviour to be consistent, since you can imagine cases like this:
Here, I think this more closely fits if we translate our predicate to English: "for all newsletters, ensure that some recipient has the email equal to bob@example.com".
My guess is that anyone who's tests pass on the current fixture treat the map as the first element of an array by wrapping it. Doing so would break the "for each newsletter" logic when you have many named newsletters.
It's possible that we previously discussed this case and I've simply forgotten, but the above is my current understanding.