Reputation: 6126
I want to ensure that the password fields are empty when editing a user. How do I do this in a functional test?
I've tried both of these variants:
assert_select "input[name=?][value=?]", 'user[password1]', ''
and
assert_tag :tag => "input", :attributes => {:name => "user[password1]", :value => ""}
Both fail because there is no value=
attribute present in the generated html. I don't see any way of testing that an attribute is not present in the generated html?
Upvotes: 3
Views: 1187
Reputation: 8408
in cucumber/webrat sth like page.should_not have_xpath("//input[contains(@value, \"\")]")
works
Upvotes: 1
Reputation: 4499
Try this:
assert_select 'input:not([value])[name="user[password1]"]', true
Upvotes: 5