Test for absence of an input tag's value attribute
- by Jeff
How can I confirm the absence of a HTML attribute in a Rails RSpec test?
I can verify that an input tag has a value attribute and that it is an empty string like so:
response.should have_tag("input[name=?][value=?]", "user[password]", "")
response.should have_tag("input[name=?][value=?]", "user[password_confirmation]", "")
But what I want to do is verify that my input fields do not have a value attribute at all (i.e., a blank field).