Trying to cover it more comprehensively, and revealing we have a lot of behaviour to update.
Products and their variants should always get saved (or not saved) together. This is considered the most intuitive behaviour.
There's still duplication with the "variant has error" context, but I try to avoid nesting shared_examples, it starts to get ugly. Happy to discuss though.
from old bulk product screen. Hmm I just realised we're deleting that screen soon anyway.
But this helps clean up the spec before I refactor it further.
Before, it would abort after the first invalid record, and it doesn't tell you about the others. This way you find out about all at once.
This affects the existing Bulk Edit Products screen, and can result in longer error messages than before. But I would argue that's a good thing.
I think this is technically optional for BUU at this point, but a helpful improvement.
I had to change some specs to keep them simple but I don't think
anything is broken. In one case, it would have needed a lot more setup
to make the spec work. But in production, the permissions are never used
with ModelSet, for example.
The mismatched use of hash attributes as strings and hash attributes as symbols here (attrs['name'] and attrs[:name]) meant that the conditional was not returning the expected results in the test.