From 1b86d90136efb98c7b331a84ca163587307a49af Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Thu, 17 May 2018 17:32:27 +0900 Subject: Enable `Performance/UnfreezeString` cop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ``` --- .../activerecord/form_helper_activerecord_test.rb | 4 +- actionview/test/fixtures/ruby_template.ruby | 2 +- actionview/test/template/date_helper_test.rb | 374 ++++++++++----------- .../test/template/form_helper/form_with_test.rb | 10 +- actionview/test/template/form_helper_test.rb | 6 +- actionview/test/template/form_tag_helper_test.rb | 4 +- actionview/test/template/javascript_helper_test.rb | 4 +- actionview/test/template/render_test.rb | 2 +- actionview/test/template/streaming_render_test.rb | 2 +- actionview/test/template/text_helper_test.rb | 8 +- actionview/test/template/url_helper_test.rb | 2 +- 11 files changed, 209 insertions(+), 209 deletions(-) (limited to 'actionview/test') diff --git a/actionview/test/activerecord/form_helper_activerecord_test.rb b/actionview/test/activerecord/form_helper_activerecord_test.rb index 1472ee8def..6c44cb9e6c 100644 --- a/actionview/test/activerecord/form_helper_activerecord_test.rb +++ b/actionview/test/activerecord/form_helper_activerecord_test.rb @@ -57,7 +57,7 @@ class FormHelperActiveRecordTest < ActionView::TestCase private def hidden_fields(method = nil) - txt = %{}.dup + txt = +%{} if method && !%w(get post).include?(method.to_s) txt << %{} @@ -67,7 +67,7 @@ class FormHelperActiveRecordTest < ActionView::TestCase end def form_text(action = "/", id = nil, html_class = nil, remote = nil, multipart = nil, method = nil) - txt = %{
\n).dup + expected = +%(\n" @@ -223,7 +223,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_day_with_blank - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -232,7 +232,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_day_nil_with_blank - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -240,7 +240,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_day_with_two_digit_numbers - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -249,7 +249,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_day_with_html_options - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -258,7 +258,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_day_with_default_prompt - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -266,7 +266,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_day_with_custom_prompt - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -274,7 +274,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_day_with_generic_with_css_classes - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -282,7 +282,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_day_with_custom_with_css_classes - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -290,7 +290,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -299,7 +299,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_two_digit_numbers - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -308,7 +308,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_disabled - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -317,7 +317,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_field_name_override - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -326,7 +326,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_blank - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -335,7 +335,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_nil_with_blank - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -343,7 +343,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_numbers - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -352,7 +352,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_numbers_and_names - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -361,7 +361,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_format_string - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -371,7 +371,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_numbers_and_names_with_abbv - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -380,7 +380,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_abbv - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -391,7 +391,7 @@ class DateHelperTest < ActionView::TestCase def test_select_month_with_custom_names month_names = %w(nil Januar Februar Marts April Maj Juni Juli August September Oktober November December) - expected = %(\n) 1.upto(12) { |month| expected << %(\n) } expected << "\n" @@ -402,7 +402,7 @@ class DateHelperTest < ActionView::TestCase def test_select_month_with_zero_indexed_custom_names month_names = %w(Januar Februar Marts April Maj Juni Juli August September Oktober November December) - expected = %(\n) 1.upto(12) { |month| expected << %(\n) } expected << "\n" @@ -419,7 +419,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_html_options - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -427,7 +427,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_default_prompt - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -435,7 +435,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_custom_prompt - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -443,7 +443,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_generic_with_css_classes - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -451,7 +451,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_month_with_custom_with_css_classes - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -459,7 +459,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -468,7 +468,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_with_disabled - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -477,7 +477,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_with_field_name_override - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -486,7 +486,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_with_type_discarding - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -497,7 +497,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_descending - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -514,7 +514,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_with_html_options - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -522,7 +522,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_with_default_prompt - expected = %(\n) expected << %(\n\n\n\n) expected << "\n" @@ -530,7 +530,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_with_custom_prompt - expected = %(\n) expected << %(\n\n\n\n) expected << "\n" @@ -538,7 +538,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_with_generic_with_css_classes - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -546,7 +546,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_with_custom_with_css_classes - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -554,7 +554,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_with_position - expected = %(\n) expected << %(\n\n\n) expected << "\n" assert_dom_equal expected, select_year(Date.current, include_position: true, start_year: 2003, end_year: 2005) @@ -570,7 +570,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_hour - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -578,7 +578,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_hour_with_ampm - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -586,7 +586,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_hour_with_disabled - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -594,7 +594,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_hour_with_field_name_override - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -602,7 +602,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_hour_with_blank - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -610,7 +610,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_hour_nil_with_blank - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -618,7 +618,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_hour_with_html_options - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -626,7 +626,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_hour_with_default_prompt - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -634,7 +634,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_hour_with_custom_prompt - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -642,7 +642,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_hour_with_generic_with_css_classes - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -650,7 +650,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_hour_with_custom_with_css_classes - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -658,7 +658,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_minute - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -666,7 +666,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_minute_with_disabled - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -674,7 +674,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_minute_with_field_name_override - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -682,7 +682,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_minute_with_blank - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -690,7 +690,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_minute_with_blank_and_step - expected = %(\n) expected << %(\n\n\n\n\n) expected << "\n" @@ -698,7 +698,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_minute_nil_with_blank - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -706,7 +706,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_minute_nil_with_blank_and_step - expected = %(\n) expected << %(\n\n\n\n\n) expected << "\n" @@ -722,7 +722,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_minute_with_html_options - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -730,7 +730,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_minute_with_default_prompt - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -738,7 +738,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_minute_with_custom_prompt - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -746,7 +746,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_minute_with_generic_with_css_classes - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -754,7 +754,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_minute_with_custom_with_css_classes - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -762,7 +762,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_second - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -770,7 +770,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_second_with_disabled - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -778,7 +778,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_second_with_field_name_override - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -786,7 +786,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_second_with_blank - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -794,7 +794,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_second_nil_with_blank - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -802,7 +802,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_second_with_html_options - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -810,7 +810,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_second_with_default_prompt - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -818,7 +818,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_second_with_custom_prompt - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -826,7 +826,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_second_with_generic_with_css_classes - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -834,7 +834,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_second_with_custom_with_css_classes - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -842,7 +842,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -867,7 +867,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_order - expected = %(\n) expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -884,7 +884,7 @@ class DateHelperTest < ActionView::TestCase def test_select_date_with_incomplete_order # Since the order is incomplete nothing will be shown - expected = %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) @@ -892,7 +892,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_disabled - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -908,7 +908,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_no_start_year - expected = %(\n) (Date.today.year - 5).upto(Date.today.year + 1) do |y| if y == Date.today.year expected << %(\n) @@ -932,7 +932,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_no_end_year - expected = %(\n) 2003.upto(2008) do |y| if y == 2003 expected << %(\n) @@ -956,7 +956,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_no_start_or_end_year - expected = %(\n) (Date.today.year - 5).upto(Date.today.year + 5) do |y| if y == Date.today.year expected << %(\n) @@ -980,7 +980,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_zero_value - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -996,7 +996,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_zero_value_and_no_start_year - expected = %(\n) (Date.today.year - 5).upto(Date.today.year + 1) { |y| expected << %(\n) } expected << "\n" @@ -1012,7 +1012,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_zero_value_and_no_end_year - expected = %(\n) last_year = Time.now.year + 5 2003.upto(last_year) { |y| expected << %(\n) } expected << "\n" @@ -1029,7 +1029,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_zero_value_and_no_start_and_end_year - expected = %(\n) (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" @@ -1045,7 +1045,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_nil_value_and_no_start_and_end_year - expected = %(\n) (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" @@ -1061,7 +1061,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_html_options - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1077,7 +1077,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_separator - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1097,7 +1097,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_separator_and_discard_day - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1113,7 +1113,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_separator_discard_month_and_day - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1124,7 +1124,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_hidden - expected = %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) @@ -1133,7 +1133,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_css_classes_option - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1149,7 +1149,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_custom_with_css_classes - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1165,7 +1165,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_css_classes_option_and_html_class_option - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1181,7 +1181,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_custom_with_css_classes_and_html_class_option - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1197,7 +1197,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_partial_with_css_classes_and_html_class_option - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1213,7 +1213,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_html_class_option - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1229,7 +1229,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1257,7 +1257,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_ampm - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1285,7 +1285,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_separators - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1313,7 +1313,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_nil_value_and_no_start_and_end_year - expected = %(\n) (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" @@ -1341,7 +1341,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_html_options - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1369,7 +1369,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_all_separators - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1405,7 +1405,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_default_prompt - expected = %(\n) expected << %(\n\n\n\n) expected << "\n" @@ -1434,7 +1434,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_custom_prompt - expected = %(\n) expected << %(\n\n\n\n) expected << "\n" @@ -1463,7 +1463,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_generic_with_css_classes - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1491,7 +1491,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_custom_with_css_classes - expected = %(\n) expected << %(\n\n\n) expected << "\n" @@ -1519,7 +1519,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_custom_hours - expected = %(\n) expected << %(\n\n\n\n) expected << "\n" @@ -1548,7 +1548,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_hidden - expected = %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) expected << %(\n) @@ -1560,7 +1560,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time - expected = %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) @@ -1579,7 +1579,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_ampm - expected = %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) @@ -1597,7 +1597,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_separator - expected = %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) expected << %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) @@ -1639,7 +1639,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_seconds_and_separator - expected = %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) @@ -1663,7 +1663,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_html_options - expected = %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) @@ -1686,7 +1686,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_default_prompt - expected = %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) @@ -1710,7 +1710,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_custom_prompt - expected = %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) @@ -1735,7 +1735,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_generic_with_css_classes - expected = %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) @@ -1759,7 +1759,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_custom_with_css_classes - expected = %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) @@ -1783,7 +1783,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_hidden - expected = %(\n).dup + expected = +%(\n) expected << %(\n) expected << %(\n) expected << %(\n) @@ -1797,7 +1797,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -1817,7 +1817,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -1837,7 +1837,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -1875,7 +1875,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = "\n".dup + expected = +"\n" expected << %{\n".dup + expected = +"\n" expected << "\n" expected << %{\n".dup + expected = +"\n" expected << %{\n".dup + expected = +"\n" expected << %{\n\n\n\n\n\n\n\n\n\n\n\n\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -1962,7 +1962,7 @@ class DateHelperTest < ActionView::TestCase concat f.date_select(:written_on) end - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -1978,7 +1978,7 @@ class DateHelperTest < ActionView::TestCase concat f.date_select(:written_on) end - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -1990,7 +1990,7 @@ class DateHelperTest < ActionView::TestCase @post.written_on = Date.new(2004, 6, 15) id = 456 - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2010,7 +2010,7 @@ class DateHelperTest < ActionView::TestCase @post.written_on = Date.new(2004, 6, 15) id = 123 - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2029,7 +2029,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} 1.upto(31) { |i| expected << %(\n) } expected << "\n" @@ -2049,7 +2049,7 @@ class DateHelperTest < ActionView::TestCase start_year = Time.now.year - 5 end_year = Time.now.year + 5 - expected = %{\n} start_year.upto(end_year) { |i| expected << %(\n) } expected << "\n" @@ -2069,7 +2069,7 @@ class DateHelperTest < ActionView::TestCase start_year = Time.now.year - 5 end_year = Time.now.year + 5 - expected = %{\n} expected << "\n" start_year.upto(end_year) { |i| expected << %(\n) } expected << "\n" @@ -2113,7 +2113,7 @@ class DateHelperTest < ActionView::TestCase start_year = Time.now.year - 5 end_year = Time.now.year + 5 - expected = %{\n} expected << "\n" start_year.upto(end_year) { |i| expected << %(\n) } expected << "\n" @@ -2145,7 +2145,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2164,7 +2164,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2188,7 +2188,7 @@ class DateHelperTest < ActionView::TestCase concat f.date_select(:written_on, {}, { class: "selector" }) end - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2208,7 +2208,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2232,7 +2232,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2255,7 +2255,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2273,7 +2273,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2293,7 +2293,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2313,7 +2313,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2333,7 +2333,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2353,7 +2353,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -2372,7 +2372,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -2391,7 +2391,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -2410,7 +2410,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %(\n) 0.upto(23) { |i| expected << %(\n) } expected << "\n" expected << " : " @@ -2425,7 +2425,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -2448,7 +2448,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -2471,7 +2471,7 @@ class DateHelperTest < ActionView::TestCase concat f.time_select(:written_on, {}, { class: "selector" }) end - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -2490,7 +2490,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -2517,7 +2517,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -2538,7 +2538,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -2559,7 +2559,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -2580,7 +2580,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -2601,7 +2601,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -2620,7 +2620,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 16, 35) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2649,7 +2649,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 16, 35) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2715,7 +2715,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2750,7 +2750,7 @@ class DateHelperTest < ActionView::TestCase concat f.datetime_select(:updated_at, {}, { class: "selector" }) end - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} expected << %{ — \n} @@ -2763,7 +2763,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2816,7 +2816,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.updated_at = nil - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2845,7 +2845,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.updated_at = nil - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2874,7 +2874,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2903,7 +2903,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2929,7 +2929,7 @@ class DateHelperTest < ActionView::TestCase end def test_date_select_with_zero_value_and_no_start_year - expected = %(\n) (Date.today.year - 5).upto(Date.today.year + 1) { |y| expected << %(\n) } expected << "\n" @@ -2945,7 +2945,7 @@ class DateHelperTest < ActionView::TestCase end def test_date_select_with_zero_value_and_no_end_year - expected = %(\n) last_year = Time.now.year + 5 2003.upto(last_year) { |y| expected << %(\n) } expected << "\n" @@ -2962,7 +2962,7 @@ class DateHelperTest < ActionView::TestCase end def test_date_select_with_zero_value_and_no_start_and_end_year - expected = %(\n) (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" @@ -2978,7 +2978,7 @@ class DateHelperTest < ActionView::TestCase end def test_date_select_with_nil_value_and_no_start_and_end_year - expected = %(\n) (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" @@ -2994,7 +2994,7 @@ class DateHelperTest < ActionView::TestCase end def test_datetime_select_with_nil_value_and_no_start_and_end_year - expected = %(\n) (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" @@ -3026,7 +3026,7 @@ class DateHelperTest < ActionView::TestCase @post.updated_at = Time.local(2004, 6, 15, 16, 35) id = 456 - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -3060,7 +3060,7 @@ class DateHelperTest < ActionView::TestCase concat f.datetime_select(:updated_at) end - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -3090,7 +3090,7 @@ class DateHelperTest < ActionView::TestCase @post.updated_at = Time.local(2004, 6, 15, 16, 35) id = @post.id - expected = %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -3119,7 +3119,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} 1999.upto(2009) { |i| expected << %(\n) } expected << "\n" expected << %{\n}.dup + expected = +%{\n} expected << %{\n" @@ -3175,7 +3175,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} 1999.upto(2009) { |i| expected << %(\n) } expected << "\n" expected << %{\n} @@ -3198,7 +3198,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -3217,7 +3217,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup + expected = +%{\n} expected << %{\n} expected << %{\n} @@ -3236,7 +3236,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} 1999.upto(2009) { |i| expected << %(\n) } expected << "\n" expected << %{\n}.dup + expected = +%{\n" expected << %{\n}.dup + expected = +%{\n" expected << %{\n}.dup + expected = +%{\n" expected << %{\n}.dup + expected = +%{\n} expected << %{\n" @@ -3353,7 +3353,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.updated_at = nil - expected = %{\n} 2001.upto(2011) { |i| expected << %(\n) } expected << "\n" expected << %{\n}.dup + expected = +%{\n" @@ -3400,7 +3400,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.updated_at = nil - expected = %{\n} (Time.now.year - 5).upto(Time.now.year + 5) { |i| expected << %(\n) } expected << "\n" expected << %{\n}.dup + expected = +%{\n" diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb index c30176349c..876e799d93 100644 --- a/actionview/test/template/form_helper/form_with_test.rb +++ b/actionview/test/template/form_helper/form_with_test.rb @@ -37,7 +37,7 @@ class FormWithActsLikeFormTagTest < FormWithTest method = options[:method] skip_enforcing_utf8 = options.fetch(:skip_enforcing_utf8, false) - "".dup.tap do |txt| + (+"").tap do |txt| unless skip_enforcing_utf8 txt << %{} end @@ -53,7 +53,7 @@ class FormWithActsLikeFormTagTest < FormWithTest method = method.to_s == "get" ? "get" : "post" - txt = %{}.dup + txt = +%{} end if method && !%w(get post).include?(method.to_s) @@ -2338,7 +2338,7 @@ class FormWithActsLikeFormForTest < FormWithTest end def form_text(action = "/", id = nil, html_class = nil, local = nil, multipart = nil, method = nil) - txt = %{}.dup + txt = +%{} else - txt = "".dup + txt = +"" end if method && !%w(get post).include?(method.to_s) @@ -3571,7 +3571,7 @@ class FormHelperTest < ActionView::TestCase end def form_text(action = "/", id = nil, html_class = nil, remote = nil, multipart = nil, method = nil) - txt = %{} end @@ -42,7 +42,7 @@ class FormTagHelperTest < ActionView::TestCase method = method.to_s == "get" ? "get" : "post" - txt = %{ tags), escape_javascript(%(dont tags)) - assert_equal %(unicode 
 newline), escape_javascript(%(unicode \342\200\250 newline).dup.force_encoding(Encoding::UTF_8).encode!) - assert_equal %(unicode 
 newline), escape_javascript(%(unicode \342\200\251 newline).dup.force_encoding(Encoding::UTF_8).encode!) + assert_equal %(unicode 
 newline), escape_javascript((+%(unicode \342\200\250 newline)).force_encoding(Encoding::UTF_8).encode!) + assert_equal %(unicode 
 newline), escape_javascript((+%(unicode \342\200\251 newline)).force_encoding(Encoding::UTF_8).encode!) assert_equal %(dont <\\/close> tags), j(%(dont tags)) end diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 6ff7ddba0f..afe68b7ff0 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -585,7 +585,7 @@ module RenderTestCases def test_render_with_passing_couple_extensions_to_one_register_template_handler_function_call ActionView::Template.register_template_handler :foo1, :foo2, CustomHandler - assert_equal @view.render(inline: "Hello, World!".dup, type: :foo1), @view.render(inline: "Hello, World!".dup, type: :foo2) + assert_equal @view.render(inline: +"Hello, World!", type: :foo1), @view.render(inline: +"Hello, World!", type: :foo2) ensure ActionView::Template.unregister_template_handler :foo1, :foo2 end diff --git a/actionview/test/template/streaming_render_test.rb b/actionview/test/template/streaming_render_test.rb index ef000300cc..f196c42c4f 100644 --- a/actionview/test/template/streaming_render_test.rb +++ b/actionview/test/template/streaming_render_test.rb @@ -19,7 +19,7 @@ class SetupFiberedBase < ActiveSupport::TestCase def buffered_render(options) body = render_body(options) - string = "".dup + string = +"" body.each do |piece| string << piece end diff --git a/actionview/test/template/text_helper_test.rb b/actionview/test/template/text_helper_test.rb index 4d47706bda..c4e420a95b 100644 --- a/actionview/test/template/text_helper_test.rb +++ b/actionview/test/template/text_helper_test.rb @@ -13,7 +13,7 @@ class TextHelperTest < ActionView::TestCase end def test_concat - self.output_buffer = "foo".dup + self.output_buffer = +"foo" assert_equal "foobar", concat("bar") assert_equal "foobar", output_buffer end @@ -106,8 +106,8 @@ class TextHelperTest < ActionView::TestCase end def test_truncate_multibyte - assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...".dup.force_encoding(Encoding::UTF_8), - truncate("\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244".dup.force_encoding(Encoding::UTF_8), length: 10) + assert_equal (+"\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...").force_encoding(Encoding::UTF_8), + truncate((+"\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244").force_encoding(Encoding::UTF_8), length: 10) end def test_truncate_does_not_modify_the_options_hash @@ -327,7 +327,7 @@ class TextHelperTest < ActionView::TestCase end def test_excerpt_with_utf8 - assert_equal("...\357\254\203ciency could not be...".dup.force_encoding(Encoding::UTF_8), excerpt("That's why e\357\254\203ciency could not be helped".dup.force_encoding(Encoding::UTF_8), "could", radius: 8)) + assert_equal((+"...\357\254\203ciency could not be...").force_encoding(Encoding::UTF_8), excerpt((+"That's why e\357\254\203ciency could not be helped").force_encoding(Encoding::UTF_8), "could", radius: 8)) end def test_excerpt_does_not_modify_the_options_hash diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb index 9d91dbb72b..7b77bae30d 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -548,7 +548,7 @@ class UrlHelperTest < ActiveSupport::TestCase def test_current_page_with_escaped_params_with_different_encoding @request = request_for_url("/") - @request.stub(:path, "/category/administra%c3%a7%c3%a3o".dup.force_encoding(Encoding::ASCII_8BIT)) do + @request.stub(:path, (+"/category/administra%c3%a7%c3%a3o").force_encoding(Encoding::ASCII_8BIT)) do assert current_page?(controller: "foo", action: "category", category: "administração") assert current_page?("http://www.example.com/category/administra%c3%a7%c3%a3o") end -- cgit v1.2.3