aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlberto Almagro Sotelo <albertoalmagro@gmail.com>2018-10-09 23:10:07 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2018-10-09 14:10:07 -0700
commit9febb318043e5320d7338f0267c6aef651cd9315 (patch)
tree883f0f625d689e56e6c78bb46d127bc1e59f452d /test
parentdc63aa42b075969359699c4076ad233d66d49eec (diff)
downloadrails-9febb318043e5320d7338f0267c6aef651cd9315.tar.gz
rails-9febb318043e5320d7338f0267c6aef651cd9315.tar.bz2
rails-9febb318043e5320d7338f0267c6aef651cd9315.zip
Prevent rich_text_area from raising when inexistent attribute is passed (#24)
When an inexistent attribute is passed as a parameter to currently existing Rails' Form Helpers they render an empty tag instead of raising an exception. This commit confers the same behavior to `rich_text_area`. Fixes #19
Diffstat (limited to 'test')
-rw-r--r--test/template/form_helper_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/template/form_helper_test.rb b/test/template/form_helper_test.rb
new file mode 100644
index 0000000000..d7bdbad26c
--- /dev/null
+++ b/test/template/form_helper_test.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+require 'test_helper'
+
+class ActionText::FormHelperTest < ActionView::TestCase
+ tests ActionText::TagHelper
+
+ def form_with(*)
+ @output_buffer = super
+ end
+
+ test "rich_text_area doesn't raise when attributes don't exist in the model" do
+ assert_nothing_raised do
+ form_with(model: Message.new, scope: :message, id: "create-message") do |form|
+ form.rich_text_area(:not_an_attribute)
+ end
+ end
+
+ assert_match "message[not_an_attribute]", output_buffer
+ end
+end