Fri Jan 18 14:31:39 EST 2008 Matt Palmer * Expose 'click' as a method that can take a link text and just click away, without needing to use select_link directly diff -rN -u old-bugfixes/lib/form_test_helper.rb new-bugfixes/lib/form_test_helper.rb --- old-bugfixes/lib/form_test_helper.rb 2008-10-20 23:30:58.516881043 +1100 +++ new-bugfixes/lib/form_test_helper.rb 2008-10-20 23:30:58.520878260 +1100 @@ -433,7 +433,7 @@ @value = value end end - + module Link def follow path = self.href diff -rN -u old-bugfixes/lib/link_methods.rb new-bugfixes/lib/link_methods.rb --- old-bugfixes/lib/link_methods.rb 2008-10-20 23:30:58.516881043 +1100 +++ new-bugfixes/lib/link_methods.rb 2008-10-20 23:30:58.520878260 +1100 @@ -19,6 +19,10 @@ link end + def click(text) + select_link(text).click + end + private def select_first_link @@ -35,4 +39,4 @@ end -end \ No newline at end of file +end diff -rN -u old-bugfixes/test/select_link_test.rb new-bugfixes/test/select_link_test.rb --- old-bugfixes/test/select_link_test.rb 2008-10-20 23:30:58.516881043 +1100 +++ new-bugfixes/test/select_link_test.rb 2008-10-20 23:30:58.520878260 +1100 @@ -58,4 +58,11 @@ assert_action_name :destroy assert_equal :delete, @request.method end + + def test_click_link_directly + render_rhtml %Q{<%= link_to 'test', {:action => 'index'} %>} + click 'test' + assert_response :success + assert_action_name :index + end end