views:

546

answers:

2

I've the following search form with image_submit_tag instead of submit_tag.

Now I get the obvious fail when cucumber runs:

When I fill in "q" with "sachin"                                               # features/step_definitions/web_steps.rb:33
And I press "submit"                                                           # features/step_definitions/web_steps.rb:21
    Could not find button "submit" (Webrat::NotFoundError)
    (eval):2:in `click_button'
    ./features/step_definitions/web_steps.rb:22:in `/^(?:|I )press "([^\"]*)"$/'
    features/search.feature:20:in `And I press "submit"'

It fails coz its looking for the submit button.

Since I'm using image_submit_tag, what will be the webrat/cuke step for this tag to make the form submit?

+1  A: 

I'm not sure if this will work or not, but try adding a title attribute to your image button:

image_submit_tag ..., :title => "submit"
jonnii
or something like :id => "submit_button" if you want an id instead
zetetic
Well, I tried both adding :id and :title, it still doesn't work.So I've removed it and went with the standard <button> element.Thanks for the comments.
Millisami
It was worth a try. FWIW I've used cuke with image links and had to use a `title` attribute. What markup does the image_submit_tag generate?
jonnii
+1  A: 

I tried this and it works using the id option:

<%= image_submit_tag "image_file_name", :id => "submit" %>

and in the feature:

And I press "submit"

Note that :title => "submit" did not work (even though the Webrat docs says that it checks for both :id and :title)

zetetic