开发者

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

开发者 https://www.devze.com 2023-01-24 02:53 出处:网络
I have two forms on a page - one for login, one for signup, and both share a field called \"user[username]\"

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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号