I need to find weather no-follow link exists in external email and it should not be in any internal email.
test "should have nofollow in external links and not in internal links in comment" do
visit @game_path
fill_in('comment_comment', :with => 'Please click link <a href='http://www.internallink.com/soccer'> internal link <a/> and click external link <a href='http://www.google.com'> external link <a/>
click_button('submit_comment')
assert page.has_no_css?('div.error'), "Error div found on page after posting comment"
assert page.has_content?('Please click link '), "Comment not found on page after posting"
ext = find(:xpath, "//a[@href='http://www.google.com']")
assert_equal(ext['rel'], "nofollow")
internal = find(:xpath, "//a[@href='http://www.internallink.com/soccer']")
assert_equal(internal.try(:rel), nil)
end
It is giving error in assert_equal(int.try(:rel), nil)
. Can anybuddy guide me for solution?
My final goal is to test in User comment, External link should have rel='nofollow' attribute present or not?