How to use assert_select to test for presence of a given link?

In assert_select, you can also use a question mark for the attribute value, and then follow with a string to match.

assert_select "a[href=?]", "https://stackoverflow.com/desired_path/1"

There’s another way to use assert_select that is more friendly, especially if you want to match a partial string or regexp pattern:

assert_select "a", :href => /acebook\.com\/share/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)