Rails 1.2.2 names the form elements like contact[subject],
contact[body] and so on. The following code does not work in latest
version.
def test_login_form_has_all_fields
get :login
assert_select “form[action=http://myapp/login] input” do |inputs|
assert_equal 3, inputs.size
assert_select inputs[0], “input[type=name][name=username]”
assert_select inputs[1], “input[type=password][name=password]”
assert_select inputs[2], “input[type=submit][value=Login]”
end
end
When the name is changed to contact[subject] format, it bombs out
saying square brackets are not right selector.
Does anyone know how to check the form elements using assert_select
tag? TIA.