Form Test Helper plugin

Plugin details

This plugin uses assert_select to verify and manipulate your forms. It solves the problem we've all run into where you change the form but the test doesn't break because you're just passing parameters to an action.

Features:
* Can also select_form / submit_form by DOM id or form action. Without arguments, expects only one form.
select_form messages_path # selecting by action (URL)
select_form 'message_form' # selects :put, :delete, etc....
* Checks for the presence of a submit button when you submit the form
* Works in functional and integration tests and the console
* Sets HTTP_REFERER header so redirect_to :back works in tests
* Can assert presence of and follow links using select_link and #follow

Websitehttp://code.google.com/p/form-test-helper/ Repositoryhttp://form-test-helper.googlecode.com/svn/form_test_helper/ Author Jason Garber, Zach Dennis Tags Tests LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://form-test-helper.googlecode.com/svn/form_test_helper/

Instead of this:

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


This plugin lets you do this:

get :new
submit_form do |form|
  form.book.name = 'Pickaxe'
  form.book.category = 'Programming'
  form.book.out_of_print.uncheck
end
assert_response :success

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: maxim_kulkin, 8 months ago