aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/form_helper_test.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-02-24 19:25:02 +0100
committerYves Senn <yves.senn@gmail.com>2014-02-24 19:25:02 +0100
commitf2577ca89f91204ee98850d89adec5263265cb7d (patch)
tree5ac3dd98a03411bdfa0d7f881ead8b8e651d42a1 /actionview/test/template/form_helper_test.rb
parentd61baee52adcd1baebe15f1065a0805857571f19 (diff)
parent2cbc8c40b4c4c900bca7039998f92c7e5142e6d1 (diff)
downloadrails-f2577ca89f91204ee98850d89adec5263265cb7d.tar.gz
rails-f2577ca89f91204ee98850d89adec5263265cb7d.tar.bz2
rails-f2577ca89f91204ee98850d89adec5263265cb7d.zip
Merge pull request #14170 from kritik/master
there could be more than 10 nested records
Diffstat (limited to 'actionview/test/template/form_helper_test.rb')
-rw-r--r--actionview/test/template/form_helper_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb
index b2c3b891a4..9f6cbd3a74 100644
--- a/actionview/test/template/form_helper_test.rb
+++ b/actionview/test/template/form_helper_test.rb
@@ -2390,6 +2390,20 @@ class FormHelperTest < ActionView::TestCase
assert_dom_equal expected, output_buffer
end
+ def test_nested_fields_label_translation_with_more_than_10_records
+ with_locale(:locale) do
+ @post.comments = Array.new(11) { |id| Comment.new(id + 1) }
+
+ I18n.expects(:t).with('post.comments.body', default: [:"comment.body", ''], scope: "helpers.label").times(11).returns "Write body here"
+
+ form_for(@post) do |f|
+ f.fields_for(:comments) do |cf|
+ concat cf.label(:body)
+ end
+ end
+ end
+ end
+
def test_nested_fields_for_with_existing_records_on_a_supplied_nested_attributes_collection_different_from_record_one
comments = Array.new(2) { |id| Comment.new(id + 1) }
@post.comments = []