Rails/Rspec: How to specify a specific form when using “fill_in”

0 votes
asked Nov 7, 2010 by plankton

I have two forms on a page - one for login, one for signup, and both share a field called "user[username]"

When running integration tests in rSpec, how do I specify that I want actions to be run on a specific form?

In solid terms, if I have a form with id 'login' and a form with id 'signup', how do I specify that I want all "fill_in", "click_button" etc commands to be run on the "signup" form?

1 Answer

+2 votes
answered Nov 29, 2018 by shingara

You just need add some scope define by css selector. So you just need to say you want fill user[name] form in form #login_form or #signup_form

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.