Test for absence of an input tag's value attribute

Posted by Jeff on Stack Overflow See other posts from Stack Overflow or by Jeff
Published on 2010-06-17T16:45:51Z Indexed on 2010/06/18 2:03 UTC
Read the original article Hit count: 390

Filed under:
|

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).

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about rspec