From 95692c6179f987db84bb358de9091cc51a2736e0 Mon Sep 17 00:00:00 2001 From: Laura Paredes Date: Mon, 31 Mar 2014 20:51:13 +0200 Subject: [PATCH] Add test for selected and disabled custom attributes in options_for_select --- .../test/template/form_options_helper_test.rb | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb index 50e9d132a7..fbafb7aa08 100644 --- a/actionview/test/template/form_options_helper_test.rb +++ b/actionview/test/template/form_options_helper_test.rb @@ -119,6 +119,26 @@ def test_array_options_for_select ) end + def test_array_options_for_select_with_custom_defined_selected + assert_dom_equal( + "\n", + options_for_select([ + ['Richard Bandler', 1, { type: 'Coach', selected: 'selected' }], + ['Richard Bandler', 1, { type: 'Coachee' }] + ]) + ) + end + + def test_array_options_for_select_with_custom_defined_disabled + assert_dom_equal( + "\n", + options_for_select([ + ['Richard Bandler', 1, { type: 'Coach', disabled: 'disabled' }], + ['Richard Bandler', 1, { type: 'Coachee' }] + ]) + ) + end + def test_array_options_for_select_with_selection assert_dom_equal( "\n\n", @@ -813,7 +833,7 @@ def test_select_with_prompt_and_selected_value select("post", "category", %w( one two ), :selected => 'two', :prompt => true) ) end - + def test_select_with_disabled_array @post = Post.new @post.category = ""