These link selectors are for system tests, so you never have to use xpath selectors, which can be brittle if HTML is moved around. They're so you can easily get an HTML class name that selects the link.
I've been meaning to make the link helpers in object_link_helper produce the same identifying HTML attributes as elsewhere in the app. (These in object_link_helper were my first draft, and I used id's as selectors, but then discovered the links are not always unique, so I switched to classes with a unique object ID.) This also removes the word "show" from the class name of plain links to the object show page, as elsewhere.
Old: <a id="show_name_link_#{name.id}">
New: <a class="name_link_#{name.id}">
Note that the selector is still "uniquely identifying" for the object link, but does not have to be literally unique, as in cases where there may be some alternative link elsewhere on the page.
TL;DR Use classes, not ids, for links
These link selectors are for system tests, so you never have to use
xpath
selectors, which can be brittle if HTML is moved around. They're so you can easily get an HTML class name that selects the link.I've been meaning to make the link helpers in
object_link_helper
produce the same identifying HTML attributes as elsewhere in the app. (These inobject_link_helper
were my first draft, and I used id's as selectors, but then discovered the links are not always unique, so I switched to classes with a unique object ID.) This also removes the word "show" from the class name of plain links to the object show page, as elsewhere.<a id="show_name_link_#{name.id}">
<a class="name_link_#{name.id}">
Note that the selector is still "uniquely identifying" for the object link, but does not have to be literally unique, as in cases where there may be some alternative link elsewhere on the page.