Check exact array contents instead of inclusion
We're using `eq` and `match_array` in most places, but there were a few places where we were still checking each element is included in the array. This is a bit dangerous, because the array could have duplicate elements, and we wouldn't detect them with `include`.
This commit is contained in:
@@ -25,8 +25,7 @@ describe Notification do
|
||||
read_notification2 = create(:notification, :read)
|
||||
unread_notification = create(:notification)
|
||||
|
||||
expect(Notification.read).to include read_notification1
|
||||
expect(Notification.read).to include read_notification2
|
||||
expect(Notification.read).to match_array [read_notification1, read_notification2]
|
||||
expect(Notification.read).not_to include unread_notification
|
||||
end
|
||||
end
|
||||
@@ -37,8 +36,7 @@ describe Notification do
|
||||
unread_notification1 = create(:notification)
|
||||
unread_notification2 = create(:notification)
|
||||
|
||||
expect(Notification.unread).to include unread_notification1
|
||||
expect(Notification.unread).to include unread_notification2
|
||||
expect(Notification.unread).to match_array [unread_notification1, unread_notification2]
|
||||
expect(Notification.unread).not_to include read_notification
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user