Fix flakiness in specs

When updating the counts, The ID arrays used are not the original array
passed to the caller method. They are being returned by ActiveRecord
with no defined order, so an exact equality check sometimes fail (which
is why this was not caught in the first place). The correct way of
doing it would be matching the set of element, hence the `match_array`
calls.

Tested:
- rspec