Jason Stewart <[email protected]> writes:
> You can do something like assert_select "a[onclick=?]", /<regexp
> here>/
Yes, for now I have made like this:
assert_select "a#{PUT}[href=?]", order_path(order, :update_timestamp => true)
and I have declared PUT in test_helper like this:
PUT = "[onclick=\"var f = document.createElement('form'); f.style.display =
'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action =
this.href;var m = document.createElement('input'); m.setAttribute('type',
'hidden'); m.setAttribute('name', '_method'); m.setAttribute('value', 'put');
f.appendChild(m);f.submit();return false;\"]"
Fortunately this PUT value is a constant because it refers to
'this.href', but my tests will break if any other javascript is
generated (in newer version of rails) that has the same functionality,
but differs in just a single space. I hoped to have some kind of test
that the execution of the javascript would result in a HTTP PUT
request.
Jarl
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---