form_test_helper plugin

With my form_test_helper Rails plugin, your functional and integration tests can work more like the browser. No longer do you need to feed params to an action:

   post :create, :name => 'Pickaxe', :category => 1, :out_of_print => 0

...and then wait for it to break silently when you change your form but forget to change the test. With form_test_helper, you just call up the form, change the values you want, and let it submit to its action.

   get :new    submit_form do |form|      form['name'] = 'Pickaxe'      form['category'] = "Programming"      form['out_of_print'].uncheck    end

...or simply:

   submit_form :name => 'Pickaxe', :category => 'Programming', :out_of_print => false

This is advantageous because it uses the action and method of the form, verifies that the form and the fields you specify are present and not misspelled, and it preserves any hidden or default values that may be in the form, like in my form_spam_protection plugin.

Features: * Can select_form / submit_form by dom_id or url--or call without arguments if there's only one form on the page * Specifying a field name that doesn't exist raises an exception * Fields that are selects (dropdowns) or radio buttons won't let you select a value that's not in its options * Selects can set using the option label or the option value * Enumerate the options for selects and radio buttons * Works with RESTful links and forms - :method => :put, :delete... * Checks for the presence of a submit button when you submit the form * Works in functional and integration tests and the console * Assert presence of and follow links * See the README file and tests for more goodies!

Installing: ./script/plugin install -x http://form-test-helper.googlecode.com/svn/form_test_helper/ Requires EdgeRails or the assert_select plugin.

Bugs/Suggestions: You can e-mail me with these or post them to http://code.google.com/p/form-test-helper

Enjoy!