Allow Webrat to read the data-method attribute
Reported by Edwin Vlieg | March 12th, 2010 @ 08:36 AM
link_to "Delete", instance, :method => :delete
In Rails 3, this will produce the following HTML:
<a href="/instance/123" data-method="delete">Delete</a>
The following monkey patch makes use of the "data-method" attribute and allows Webrat to follow delete links in Rails 3.
module Webrat class Link < Element def http_method if !@element["data-method"].blank? @element["data-method"] elsif !onclick.blank? && onclick.include?("f.submit()") http_method_from_js_form else :get end end end end
Comments and changes to this ticket
Commit with failing test case and fix on Github: http://github.com/bluetools/webrat/commit/afc4599dbecf05fa7d3f209a7...