2

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.

shingara
  • 46,608
  • 11
  • 99
  • 105
GaetanJUVIN
  • 119
  • 3
  • 7

2 Answers2

1

The method :delete us Javascript to made the good request to you server with a POST and _method='put".

Webrat don't know how interprete the Javascript. If you want that, you need use some backend with it. Capybara or Selenium.

shingara
  • 46,608
  • 11
  • 99
  • 105
  • There is a simple patch to get webrat to work with the rails3 unobtrusive js, see: https://webrat.lighthouseapp.com/projects/10503/tickets/365-allow-webrat-to-read-the-data-method-attribute – Greg Fairbrother Jan 05 '11 at 04:42
0

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.

Greg Fairbrother
  • 1,041
  • 8
  • 13