expect(content).to have_css("input[type='checkbox'][checked='checked']#rawr")
A blog about the problems I've encountered while being a Ruby on Rails developer, and how I've solved them.
Sunday, February 15, 2015
Testing Multiple Attributes of an Input Field
Sometimes in a view or feature spec, you want to test multiple attributes of an input field (or some other field). For example, you might want to test that the input field is a checkbox and is checked, as well as testing that the field has the id #rawr. This is how you would do that in a view spec (feature spec is similar):
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment