aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/form_options_helper_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-06-08 12:53:08 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-06-08 12:53:08 -0300
commita69e0a5fcfbcd76f259ab1ed290fafa8726b44ba (patch)
tree7372acefce4ae672f204c07f6282bd2916724aa0 /actionview/test/template/form_options_helper_test.rb
parentaeac00feb41ec99ef39b79cae31546ca875188d9 (diff)
parent077540738460d44c1463b3e52d2acb1fed9bc766 (diff)
downloadrails-a69e0a5fcfbcd76f259ab1ed290fafa8726b44ba.tar.gz
rails-a69e0a5fcfbcd76f259ab1ed290fafa8726b44ba.tar.bz2
rails-a69e0a5fcfbcd76f259ab1ed290fafa8726b44ba.zip
Merge pull request #20124 from greysteil/fix-select-helper
Raise an ArgumentError when `include_blank` is false for a required select field
Diffstat (limited to 'actionview/test/template/form_options_helper_test.rb')
-rw-r--r--actionview/test/template/form_options_helper_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb
index d25fa3706f..d7daba8bf3 100644
--- a/actionview/test/template/form_options_helper_test.rb
+++ b/actionview/test/template/form_options_helper_test.rb
@@ -645,6 +645,13 @@ class FormOptionsHelperTest < ActionView::TestCase
)
end
+ def test_select_with_include_blank_false_and_required
+ @post = Post.new
+ @post.category = "<mus>"
+ e = assert_raises(ArgumentError) { select("post", "category", %w( abe <mus> hest), { include_blank: false }, required: 'required') }
+ assert_match(/include_blank cannot be false for a required field./, e.message)
+ end
+
def test_select_with_blank_as_string
@post = Post.new
@post.category = "<mus>"