From d108288c2f684233298f97f18ac00de0b016deaa Mon Sep 17 00:00:00 2001 From: Dillon Welch Date: Thu, 29 Mar 2018 19:29:55 -0700 Subject: Turn on performance based cops Use attr_reader/attr_writer instead of methods method is 12% slower Use flat_map over map.flatten(1) flatten is 66% slower Use hash[]= instead of hash.merge! with single arguments merge! is 166% slower See https://github.com/rails/rails/pull/32337 for more conversation --- actionview/test/template/form_helper/form_with_test.rb | 3 ++- actionview/test/template/form_helper_test.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'actionview/test') diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb index f07e494ee3..c30176349c 100644 --- a/actionview/test/template/form_helper/form_with_test.rb +++ b/actionview/test/template/form_helper/form_with_test.rb @@ -318,7 +318,8 @@ class FormWithActsLikeFormForTest < FormWithTest @url_for_options = object if object.is_a?(Hash) && object[:use_route].blank? && object[:controller].blank? - object.merge!(controller: "main", action: "index") + object[:controller] = "main" + object[:action] = "index" end super diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb index 5244204e42..38bb1e1d24 100644 --- a/actionview/test/template/form_helper_test.rb +++ b/actionview/test/template/form_helper_test.rb @@ -168,7 +168,8 @@ class FormHelperTest < ActionView::TestCase @url_for_options = object if object.is_a?(Hash) && object[:use_route].blank? && object[:controller].blank? - object.merge!(controller: "main", action: "index") + object[:controller] = "main" + object[:action] = "index" end super -- cgit v1.2.3