Search code examples
ruby-on-railsunit-testingcucumberwebrat

How can i unit test a "Delete link" with Ror, cucumber - webrat?


I am currently developing a Rails application, I'm trying to units test it. I chose Cucumber + WebRater. I'd like to test in my backend all delete link.

I tried to go to visit a second argument (the method: delete) without success. (something like : visit my_path, method => :delete)

On my pages I delete some links so the solution click_link ("Delete") is not acceptable.

I appeal to your experience in this field.

Thank you in advance

Gaetan.


Solution

  • Webrat just needs a simple patch to get it to work with rails3's new unobtrusive JavaScript.

    See here for explanation and a link to the patch:

    https://webrat.lighthouseapp.com/projects/10503/tickets/365-allow-webrat-to-read-the-data-method-attribute

    Worked for me.