jnicklas/capybara — pull request #1160 by liquid (2013-09-11 10:15:24+00:00)
Title: Add a :rel filter to links.

__Motivation:__

While I would be careful with adding many filters to Capybara's selectors, I think this is something that is useful and relatively common. Having this as part of the list of supported link filters in Capybara would also help raising awareness of SEO optimisations of web applications via the use of proper 'rel' attributes.

See the [relevant W3C page](http://dev.w3.org/html5/spec-preview/links.html#link-type-nofollow) to get a better context if necessary.

__Proposed solution:__

Rather than having to rely on an ugly Xpath selector, this pull request adds support to filter links based on 'rel' attributes. This allows us to better describe links for SEO and do things like:

```ruby
has_link 'Next', { rel: 'next' }
has_link 'Previous', { rel: 'prev' }
has_link 'Sign In', { rel: 'nofollow' }
```