From decff3f43e5549cbc8b89f974460de3d71407042 Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Mon, 20 Feb 2012 22:55:46 +0300 Subject: refactor options_for_select --- .../test/template/form_options_helper_test.rb | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb index bed67e35b3..6b8d62df62 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -182,16 +182,16 @@ class FormOptionsHelperTest < ActionView::TestCase def test_hash_options_for_select assert_dom_equal( - "\n", - options_for_select("$" => "Dollar", "" => "").split("\n").sort.join("\n") + "\n", + options_for_select("$" => "Dollar", "" => "").split("\n").join("\n") ) assert_dom_equal( - "\n", - options_for_select({ "$" => "Dollar", "" => "" }, "Dollar").split("\n").sort.join("\n") + "\n", + options_for_select({ "$" => "Dollar", "" => "" }, "Dollar").split("\n").join("\n") ) assert_dom_equal( - "\n", - options_for_select({ "$" => "Dollar", "" => "" }, [ "Dollar", "" ]).split("\n").sort.join("\n") + "\n", + options_for_select({ "$" => "Dollar", "" => "" }, [ "Dollar", "" ]).split("\n").join("\n") ) end @@ -1056,36 +1056,36 @@ class FormOptionsHelperTest < ActionView::TestCase end def test_option_html_attributes_from_without_hash - assert_dom_equal( - "", + assert_equal( + {}, option_html_attributes([ 'foo', 'bar' ]) ) end def test_option_html_attributes_with_single_element_hash - assert_dom_equal( - " class=\"fancy\"", + assert_equal( + {:class => 'fancy'}, option_html_attributes([ 'foo', 'bar', { :class => 'fancy' } ]) ) end def test_option_html_attributes_with_multiple_element_hash - assert_dom_equal( - " class=\"fancy\" onclick=\"alert('Hello World');\"", + assert_equal( + {:class => 'fancy', 'onclick' => "alert('Hello World');"}, option_html_attributes([ 'foo', 'bar', { :class => 'fancy', 'onclick' => "alert('Hello World');" } ]) ) end def test_option_html_attributes_with_multiple_hashes - assert_dom_equal( - " class=\"fancy\" onclick=\"alert('Hello World');\"", + assert_equal( + {:class => 'fancy', 'onclick' => "alert('Hello World');"}, option_html_attributes([ 'foo', 'bar', { :class => 'fancy' }, { 'onclick' => "alert('Hello World');" } ]) ) end def test_option_html_attributes_with_special_characters - assert_dom_equal( - " onclick=\"alert("<code>")\"", + assert_equal( + {:onclick => "alert("<code>")"}, option_html_attributes([ 'foo', 'bar', { :onclick => %(alert("")) } ]) ) end -- cgit v1.2.3