On 2 May 2011 13:53, Pablo L. de Miranda <pablolmira...@gmail.com> wrote: > Hi guys, > > I'm writing a integration test and i'm still have problems with a form field. > The RSpec continues to show me a message bellow: > > Failure/Error: fill_in :password_confirmation, :with => > @attr[:password_confirmation] > Webrat::NotFoundError: > Could not find field: :password_confirmation > > But the field is there, look the field code: > > <div> > <%= f.label :password_confirmation %> > <%= f.password_field :password_confirmation %> > </div> > > This field create the follow HTML code for me: > > <div> > <label for="subdomain_password_confirmation">Password confirmation</label> > <input id="subdomain_password_confirmation" > name="subdomain[password_confirmation]" size="30" type="password" /> > </div> > > And it works fine when I use the browser. > > Please, Has anybody idea of what's happening?
Webrat only sees the generated HTML, not the view code. In particular, it finds the field based on either the text of an associated label, or the 'name' attribute of the field: http://rdoc.info/github/brynary/webrat/master/Webrat/Scope:fill_in In your case, the text of the associated label is "Password confirmation" and the 'name' attribute of the field is "subdomain[password_confirmation]" (which you can check by looking at the generated HTML). So you need to pass one of those to the 'fill_in' method. Chris _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users