From e6e0579defcfcf94ef1c4c1c7659f374a5335cdb Mon Sep 17 00:00:00 2001 From: Andy Waite Date: Sun, 5 May 2013 12:32:00 +0100 Subject: Add params option for button_to The parameters are rendered as hidden form fields within the generated form. This is useful for when a record has multiple buttons associated with it, each of which target the same controller method, but which need to submit different attributes. --- actionview/test/template/url_helper_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'actionview/test/template/url_helper_test.rb') diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb index d512fa9913..850b8a62e9 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -160,6 +160,13 @@ class UrlHelperTest < ActiveSupport::TestCase ) end + def test_button_to_with_params + assert_dom_equal( + %{
}, + button_to("Hello", "http://www.example.com", params: {foo: :bar, baz: "quux"}) + ) + end + def test_link_tag_with_straight_url assert_dom_equal %{Hello}, link_to("Hello", "http://www.example.com") end -- cgit v1.2.3