Using click /change/i is a good way of testing you links/methods, since it will assure your views render the valid link and you do not have to repeat the link parameters as in get :edit, :id=>3
- get form_test_helper with
script/plugin install http://form-test-helper.googlecode.com/svn/form_test_helper/ - patch vendor/plugins/form_test_helper/lib/form_test_helper.rb
- if self["onclick"] && self["onclick"] =~ /'_method'.*'value', '(\w+)'/ - $1.to_sym + if self["onclick"] && self["onclick"] =~ /\.method = '(.*)'/ + $1.downcase.to_sym
- insert helper to test/test_helper.rb
def click(text) select_link(text).click end
- click click click clickaround!
def test_should_not_upload_from_ftp login_as :aaron assert_invalid_upload do `cp -f test/fixtures/videos/test.mov #{ftp_accounts(:aaron).dir}/wrong_name.flv` click /upload.*ftp/i assert_response :redirect assert flash[:alert] end end