Hi.

In my view I have a line like this:

link_to('Update timestamp', order_path(@order, :update_timestamp => true), 
:method => :put

This generates HTML like this
<a href="/orders/2131771394?update_timestamp=true" 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;">Update timestamp</a>

Basically it creates a normal link, which is overridden by a
javascript function to send a (simulated) put request in stead, that
is all fine, however I would like to create test that asserts that
this javascript is there.

Basically I would like to create a test that fails if my view code was
like this:
link_to('Update timestamp', order_path(@order, :update_timestamp => true)

that is *without* the ':method => :put' as html_options
If I just have a standard assert, like 
assert_select "a[href=?]", order_path(order, :update_timestamp => true)
it succeeds even  if ':method => :put' is not there.

Does anyone have a good idea of how to assert this.

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to