I have a link as follows that I'm trying to test (please ignore the square brackets):
[%= link_to "Delete User", destroy_user_account_path(@profile.user), :class => "delete", :confirm => "a", :title => "Delete #{@profile.user.name}", :method => :delete %]
The test below fails, though if I comment out the :confirm => "a" line, it passes:
it "should have a link to delete the user's account (using the destroy_user_account action in the registrations controller)" do get :show, :id => @profile response.should have_selector("a", :href => destroy_user_account_path(@profile.user), :confirm => "a", :title => "Delete #{@profile.user.name}", :class => "delete", :content => "Delete User") end
Behold my failure :(
Failure/Error: response.should have_selector("a", expected following output to contain a <a title='Delete Michael Hartl' class='delete' href='/destroy-user-account/159' confirm='a'>Delete User</a> tag:
The actual html output for this line is as follows (again, the square brackets are mine). I note it's output "data-confirm" as an attribute in here rather than the "confirm" one that the test is expecting.
[a href="/destroy-user-account/159" class="delete" data-confirm="a" data-method="delete" rel="nofollow" title="Delete Michael Hartl"]Delete User[/a]
Can anyone explain what the difference is between confirm and data-confirm in this context, and help me figure out why I'm getting this error/how to fix it?
Thanks!