This comes from the Rails Tutorial:
expect { click_link('delete') }.to change(User, :count).by(-1)
If the page being tested has several links called “delete”, but each has a different URI (based on an id), how then does Capybara know which link to click?
It checks the id, value and text of a given element. If you have non-unique links, you may need to scope the click command
Also, for that particular test, it’s not going to matter because all the links refer to deleting a user