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, "input[type=name][name=username]" assert_select inputs, "input[type=password][name=password]" assert_select inputs, "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.
on 2007-02-28 19:03
on 2007-02-28 21:25
bcparanj wrote: > Does anyone know how to check the form elements using assert_select > tag? TIA. You could query by id, typically "user_username". I just do this. Much more powerful: form = select_form 'my_form_id' assert_equal 'foo', form['user[username]'] form.submit -- Phlip http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!