Test Helpful plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install http://railsjob.googlecode.com/svn/trunk/vendor/plugins/test_helpful/
You need not to define matrix_init_xxx method, but init with block:
In your test case:
def setup init(:logined){ login_as :dongbin} end
then "login_as :dongbin" will be called when setup include "logined"
Reuse your test with after_filter
In your test case
after_filter :render_form, :new, :edit def matrix_test_render_form assert_response :success assert assigns(:job) assert_form(assigns(:job), *@@job_default_attr.keys) end def matrix_test_new assert_template 'new' end def matrix_test_edit assert_template 'edit' end
Then matrix_test_render_form will be called after matrix_test_new or matrix_test_edit
#assert_form assert_form(@user, :email, :password)
equals to
assert_select("form[action=/users]") do assert_select("#user_email[name=?]", "user[email]") assert_select("#user_password[name=?]", "user[password]") assert_select("input[type=submit]") end # Add a method named "create" for unit tests and functional tests
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | Back in time (1 older version) | Last edited by: scott, 9 months ago

