Topic: Cucumber and DELETE method


It seems that cucumber (or perhaps webrat?) does not follow link to destroy action correctly. In my log I see GET method where it should be DELETE. I am using rails 3.0.3, jquery and jquery version of rails.js, and it works fine in the browser. Could anybody give me a hint on this?

Is it even supposed to run all that javascript which is actually responsible for the DELETE method?

If not - how do people go around this?

P.S. I am using the 'I follow "..."' step for this...

Last edited by bluesman.alex (2011-01-23 10:50:11)

Re: Cucumber and DELETE method

If somebody has the same question...

It seems like webrat just does not support it. I'm going to try to replace it with capybara.

Re: Cucumber and DELETE method

You could monkey patch webrat with the following:


# Webrat follow Rails 3 delete links extension.
module Webrat
  class Link < Element
    def http_method
      if !@element["data-method"].blank?
      elsif !onclick.blank? && onclick.include?("f.submit()")

Re: Cucumber and DELETE method

Thanks, I'll just stick to capybara. It works all right smile