How to assert a simple link (testing)

<%= link_to ‘my_profile’,:controller => ‘users’, :action => ‘show’, :id
=> current_user.id %>

my_profile

What is the easy and simple way to assert this link in testing.

On Jul 14, 11:09 am, Raj S. [email protected]
wrote:

<%= link_to ‘my_profile’,:controller => ‘users’, :action => ‘show’, :id
=> current_user.id %>

my_profile

What is the easy and simple way to assert this link in testing.

What are you trying to assert? That the correct link was generated ?
That the link corresponds to a page that exists? Something else?

Fred

That the page has a link which has href content as
http://localhost:3000/users/show/2 and the correspoding text is
‘my_profile’ in the html document.

On Jul 14, 1:46 pm, Raj S. [email protected]
wrote:

That the page has a link which has href content ashttp://localhost:3000/users/show/2and the correspoding text is
‘my_profile’ in the html document.

assert_select/assert_tag allow you to do that (although I’d consider
this to be a bit over the top)

Fred