Topic: I cant figure out Webrat... Webrat::NotFoundError: Could not find fiel

Sorry for the stupid question but i cant find it anywhere why this isnt working for me and i am still a big newb with testing

This is my form:

<%= f.label :name, "Name" %>
<%= f.text_field :name %>

And i have this in my test:

test do
    visit new_message_path
    fill_in "Name", :with => "mokkol"
end

and i get this error:

Webrat::NotFoundError: Could not find field: "Name"

Somebody knows what to do?

I have webrat (0.5.3)
and Rails 2.3.4

Thanks!

Re: I cant figure out Webrat... Webrat::NotFoundError: Could not find fiel

Looks like you are using form_for and need to use the prefix for your object.  Maybe?

fill_in 'user_name', :with => "mokkol"

Where user_name should be <object>_name for the object represented in the form_for.

It should work the way you have it though, but I've seen this before and thought I'd mention it.