From 3d453b409d037a056d0bcd636a2e020cc7cef4a8 Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Tue, 20 Jun 2017 22:20:04 +1000 Subject: [PATCH] Make ActionView frozen string literal friendly. Plus a couple of related ActionPack patches. --- .../lib/action_controller/log_subscriber.rb | 2 +- .../action_dispatch/journey/router/utils.rb | 2 +- .../testing/assertions/response.rb | 2 +- .../lib/action_view/helpers/date_helper.rb | 4 +- .../action_view/helpers/translation_helper.rb | 2 +- actionview/lib/action_view/log_subscriber.rb | 4 +- actionview/lib/action_view/template.rb | 2 +- actionview/lib/action_view/test_case.rb | 2 +- .../lib/action_view/testing/resolvers.rb | 2 +- .../form_helper_activerecord_test.rb | 4 +- actionview/test/fixtures/ruby_template.ruby | 2 +- .../test/template/atom_feed_helper_test.rb | 2 +- actionview/test/template/date_helper_test.rb | 374 +++++++++--------- .../template/form_helper/form_with_test.rb | 10 +- actionview/test/template/form_helper_test.rb | 6 +- .../test/template/form_tag_helper_test.rb | 4 +- .../test/template/javascript_helper_test.rb | 4 +- actionview/test/template/render_test.rb | 4 +- .../test/template/streaming_render_test.rb | 2 +- actionview/test/template/template_test.rb | 2 +- actionview/test/template/text_helper_test.rb | 8 +- actionview/test/template/url_helper_test.rb | 2 +- 22 files changed, 223 insertions(+), 223 deletions(-) diff --git a/actionpack/lib/action_controller/log_subscriber.rb b/actionpack/lib/action_controller/log_subscriber.rb index d00fcbcd13..5d75393897 100644 --- a/actionpack/lib/action_controller/log_subscriber.rb +++ b/actionpack/lib/action_controller/log_subscriber.rb @@ -24,7 +24,7 @@ def process_action(event) exception_class_name = payload[:exception].first status = ActionDispatch::ExceptionWrapper.status_code_for_exception(exception_class_name) end - message = "Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in #{event.duration.round}ms" + message = "Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in #{event.duration.round}ms".dup message << " (#{additions.join(" | ".freeze)})" unless additions.empty? message << "\n\n" if defined?(Rails.env) && Rails.env.development? diff --git a/actionpack/lib/action_dispatch/journey/router/utils.rb b/actionpack/lib/action_dispatch/journey/router/utils.rb index b3896faf56..1ac86d10d6 100644 --- a/actionpack/lib/action_dispatch/journey/router/utils.rb +++ b/actionpack/lib/action_dispatch/journey/router/utils.rb @@ -18,7 +18,7 @@ def self.normalize_path(path) path.squeeze!("/".freeze) path.sub!(%r{/+\Z}, "".freeze) path.gsub!(/(%[a-f0-9]{2})/) { $1.upcase } - path = "/" if path == "".freeze + path = "/".dup if path == "".freeze path.force_encoding(encoding) path end diff --git a/actionpack/lib/action_dispatch/testing/assertions/response.rb b/actionpack/lib/action_dispatch/testing/assertions/response.rb index 1baf979ac9..749f2eab57 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/response.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/response.rb @@ -79,7 +79,7 @@ def normalize_argument_to_redirection(fragment) def generate_response_message(expected, actual = @response.response_code) "Expected response to be a <#{code_with_name(expected)}>,"\ " but was a <#{code_with_name(actual)}>" - .concat(location_if_redirected).concat(response_body_if_short) + .dup.concat(location_if_redirected).concat(response_body_if_short) end def response_body_if_short diff --git a/actionview/lib/action_view/helpers/date_helper.rb b/actionview/lib/action_view/helpers/date_helper.rb index 3f43465aa4..d28eec88a1 100644 --- a/actionview/lib/action_view/helpers/date_helper.rb +++ b/actionview/lib/action_view/helpers/date_helper.rb @@ -1007,7 +1007,7 @@ def build_select(type, select_options_as_html) select_options[:disabled] = "disabled" if @options[:disabled] select_options[:class] = css_class_attribute(type, select_options[:class], @options[:with_css_classes]) if @options[:with_css_classes] - select_html = "\n" + select_html = "\n".dup select_html << content_tag("option".freeze, "", value: "") + "\n" if @options[:include_blank] select_html << prompt_option_tag(type, @options[:prompt]) + "\n" if @options[:prompt] select_html << select_options_as_html @@ -1089,7 +1089,7 @@ def input_id_from_type(type) # Given an ordering of datetime components, create the selection HTML # and join them with their appropriate separators. def build_selects_from_types(order) - select = "" + select = "".dup first_visible = order.find { |type| !@options[:"discard_#{type}"] } order.reverse_each do |type| separator = separator(type) unless type == first_visible # don't add before first visible field diff --git a/actionview/lib/action_view/helpers/translation_helper.rb b/actionview/lib/action_view/helpers/translation_helper.rb index cc928f2b7a..24d1f34c5a 100644 --- a/actionview/lib/action_view/helpers/translation_helper.rb +++ b/actionview/lib/action_view/helpers/translation_helper.rb @@ -95,7 +95,7 @@ def translate(key, options = {}) raise e if raise_error keys = I18n.normalize_keys(e.locale, e.key, e.options[:scope]) - title = "translation missing: #{keys.join('.')}" + title = "translation missing: #{keys.join('.')}".dup interpolations = options.except(:default, :scope) if interpolations.any? diff --git a/actionview/lib/action_view/log_subscriber.rb b/actionview/lib/action_view/log_subscriber.rb index ab8ec0aa42..613be2b877 100644 --- a/actionview/lib/action_view/log_subscriber.rb +++ b/actionview/lib/action_view/log_subscriber.rb @@ -14,7 +14,7 @@ def initialize def render_template(event) info do - message = " Rendered #{from_rails_root(event.payload[:identifier])}" + message = " Rendered #{from_rails_root(event.payload[:identifier])}".dup message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout] message << " (#{event.duration.round(1)}ms)" end @@ -22,7 +22,7 @@ def render_template(event) def render_partial(event) info do - message = " Rendered #{from_rails_root(event.payload[:identifier])}" + message = " Rendered #{from_rails_root(event.payload[:identifier])}".dup message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout] message << " (#{event.duration.round(1)}ms)" message << " #{cache_message(event.payload)}" unless event.payload[:cache_hit].nil? diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index 3a69860630..3f2546664e 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -329,7 +329,7 @@ def locals_code locals = locals.grep(/\A@?(?![A-Z0-9])(?:[[:alnum:]_]|[^\0-\177])+\z/) # Double assign to suppress the dreaded 'assigned but unused variable' warning - locals.each_with_object("") { |key, code| code << "#{key} = #{key} = local_assigns[:#{key}];" } + locals.each_with_object("".dup) { |key, code| code << "#{key} = #{key} = local_assigns[:#{key}];" } end def method_name diff --git a/actionview/lib/action_view/test_case.rb b/actionview/lib/action_view/test_case.rb index 80403799ab..424a86ba3e 100644 --- a/actionview/lib/action_view/test_case.rb +++ b/actionview/lib/action_view/test_case.rb @@ -104,7 +104,7 @@ def setup_with_controller # empty string ensures buffer has UTF-8 encoding as # new without arguments returns ASCII-8BIT encoded buffer like String#new @output_buffer = ActiveSupport::SafeBuffer.new "" - @rendered = "" + @rendered = "".dup make_test_case_available_to_view! say_no_to_protect_against_forgery! diff --git a/actionview/lib/action_view/testing/resolvers.rb b/actionview/lib/action_view/testing/resolvers.rb index 3188526b63..b2d3e10690 100644 --- a/actionview/lib/action_view/testing/resolvers.rb +++ b/actionview/lib/action_view/testing/resolvers.rb @@ -20,7 +20,7 @@ def to_s private def query(path, exts, _, _) - query = "" + query = "".dup EXTENSIONS.each_key do |ext| query << "(" << exts[ext].map { |e| e && Regexp.escape(".#{e}") }.join("|") << "|)" end diff --git a/actionview/test/activerecord/form_helper_activerecord_test.rb b/actionview/test/activerecord/form_helper_activerecord_test.rb index 3b314588c7..9949c3fde0 100644 --- a/actionview/test/activerecord/form_helper_activerecord_test.rb +++ b/actionview/test/activerecord/form_helper_activerecord_test.rb @@ -55,7 +55,7 @@ def test_nested_fields_for_with_child_index_option_override_on_a_nested_attribut private def hidden_fields(method = nil) - txt = %{} + txt = %{}.dup if method && !%w(get post).include?(method.to_s) txt << %{} @@ -65,7 +65,7 @@ def hidden_fields(method = nil) end def form_text(action = "/", id = nil, html_class = nil, remote = nil, multipart = nil, method = nil) - txt = %{
'') + new_xml = Builder::XmlMarkup.new(:target=>''.dup) atom_feed(:xml => new_xml) do |feed| feed.title("My great blog!") feed.updated(@scrolls.first.created_at) diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb index b667303318..b9b8194e69 100644 --- a/actionview/test/template/date_helper_test.rb +++ b/actionview/test/template/date_helper_test.rb @@ -214,7 +214,7 @@ def test_time_ago_in_words end def test_select_day - expected = %(\n).dup 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" @@ -223,7 +223,7 @@ def test_select_day end def test_select_day_with_blank - expected = %(\n).dup 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 @@ def test_select_day_with_blank end def test_select_day_nil_with_blank - expected = %(\n).dup 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 @@ def test_select_day_nil_with_blank end def test_select_day_with_two_digit_numbers - expected = %(\n).dup 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 @@ def test_select_day_with_two_digit_numbers end def test_select_day_with_html_options - expected = %(\n).dup 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 @@ def test_select_day_with_html_options end def test_select_day_with_default_prompt - expected = %(\n).dup 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 @@ def test_select_day_with_default_prompt end def test_select_day_with_custom_prompt - expected = %(\n).dup 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 @@ def test_select_day_with_custom_prompt end def test_select_day_with_generic_with_css_classes - expected = %(\n).dup 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 @@ def test_select_day_with_generic_with_css_classes end def test_select_day_with_custom_with_css_classes - expected = %(\n).dup 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 @@ def test_select_day_with_custom_with_css_classes end def test_select_month - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -299,7 +299,7 @@ def test_select_month end def test_select_month_with_two_digit_numbers - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -308,7 +308,7 @@ def test_select_month_with_two_digit_numbers end def test_select_month_with_disabled - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -317,7 +317,7 @@ def test_select_month_with_disabled end def test_select_month_with_field_name_override - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -326,7 +326,7 @@ def test_select_month_with_field_name_override end def test_select_month_with_blank - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -335,7 +335,7 @@ def test_select_month_with_blank end def test_select_month_nil_with_blank - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -343,7 +343,7 @@ def test_select_month_nil_with_blank end def test_select_month_with_numbers - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -352,7 +352,7 @@ def test_select_month_with_numbers end def test_select_month_with_numbers_and_names - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -361,7 +361,7 @@ def test_select_month_with_numbers_and_names end def test_select_month_with_format_string - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -371,7 +371,7 @@ def test_select_month_with_format_string end def test_select_month_with_numbers_and_names_with_abbv - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -380,7 +380,7 @@ def test_select_month_with_numbers_and_names_with_abbv end def test_select_month_with_abbv - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -391,7 +391,7 @@ def test_select_month_with_abbv 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).dup 1.upto(12) { |month| expected << %(\n) } expected << "\n" @@ -402,7 +402,7 @@ def test_select_month_with_custom_names 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).dup 1.upto(12) { |month| expected << %(\n) } expected << "\n" @@ -419,7 +419,7 @@ def test_select_month_with_hidden_and_field_name end def test_select_month_with_html_options - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -427,7 +427,7 @@ def test_select_month_with_html_options end def test_select_month_with_default_prompt - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -435,7 +435,7 @@ def test_select_month_with_default_prompt end def test_select_month_with_custom_prompt - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -443,7 +443,7 @@ def test_select_month_with_custom_prompt end def test_select_month_with_generic_with_css_classes - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -451,7 +451,7 @@ def test_select_month_with_generic_with_css_classes end def test_select_month_with_custom_with_css_classes - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -459,7 +459,7 @@ def test_select_month_with_custom_with_css_classes end def test_select_year - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -468,7 +468,7 @@ def test_select_year end def test_select_year_with_disabled - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -477,7 +477,7 @@ def test_select_year_with_disabled end def test_select_year_with_field_name_override - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -486,7 +486,7 @@ def test_select_year_with_field_name_override end def test_select_year_with_type_discarding - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -497,7 +497,7 @@ def test_select_year_with_type_discarding end def test_select_year_descending - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -514,7 +514,7 @@ def test_select_year_with_hidden_and_field_name end def test_select_year_with_html_options - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -522,7 +522,7 @@ def test_select_year_with_html_options end def test_select_year_with_default_prompt - expected = %(\n).dup expected << %(\n\n\n\n) expected << "\n" @@ -530,7 +530,7 @@ def test_select_year_with_default_prompt end def test_select_year_with_custom_prompt - expected = %(\n).dup expected << %(\n\n\n\n) expected << "\n" @@ -538,7 +538,7 @@ def test_select_year_with_custom_prompt end def test_select_year_with_generic_with_css_classes - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -546,7 +546,7 @@ def test_select_year_with_generic_with_css_classes end def test_select_year_with_custom_with_css_classes - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -554,14 +554,14 @@ def test_select_year_with_custom_with_css_classes end def test_select_year_with_position - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" assert_dom_equal expected, select_year(Date.current, include_position: true, start_year: 2003, end_year: 2005) end def test_select_hour - expected = %(\n).dup 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" @@ -569,7 +569,7 @@ def test_select_hour end def test_select_hour_with_ampm - expected = %(\n).dup 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" @@ -577,7 +577,7 @@ def test_select_hour_with_ampm end def test_select_hour_with_disabled - expected = %(\n).dup 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" @@ -585,7 +585,7 @@ def test_select_hour_with_disabled end def test_select_hour_with_field_name_override - expected = %(\n).dup 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" @@ -593,7 +593,7 @@ def test_select_hour_with_field_name_override end def test_select_hour_with_blank - expected = %(\n).dup 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" @@ -601,7 +601,7 @@ def test_select_hour_with_blank end def test_select_hour_nil_with_blank - expected = %(\n).dup 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" @@ -609,7 +609,7 @@ def test_select_hour_nil_with_blank end def test_select_hour_with_html_options - expected = %(\n).dup 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" @@ -617,7 +617,7 @@ def test_select_hour_with_html_options end def test_select_hour_with_default_prompt - expected = %(\n).dup 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" @@ -625,7 +625,7 @@ def test_select_hour_with_default_prompt end def test_select_hour_with_custom_prompt - expected = %(\n).dup 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" @@ -633,7 +633,7 @@ def test_select_hour_with_custom_prompt end def test_select_hour_with_generic_with_css_classes - expected = %(\n).dup 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" @@ -641,7 +641,7 @@ def test_select_hour_with_generic_with_css_classes end def test_select_hour_with_custom_with_css_classes - expected = %(\n).dup 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" @@ -649,7 +649,7 @@ def test_select_hour_with_custom_with_css_classes end def test_select_minute - expected = %(\n).dup 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" @@ -657,7 +657,7 @@ def test_select_minute end def test_select_minute_with_disabled - expected = %(\n).dup 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" @@ -665,7 +665,7 @@ def test_select_minute_with_disabled end def test_select_minute_with_field_name_override - expected = %(\n).dup 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" @@ -673,7 +673,7 @@ def test_select_minute_with_field_name_override end def test_select_minute_with_blank - expected = %(\n).dup 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" @@ -681,7 +681,7 @@ def test_select_minute_with_blank end def test_select_minute_with_blank_and_step - expected = %(\n).dup expected << %(\n\n\n\n\n) expected << "\n" @@ -689,7 +689,7 @@ def test_select_minute_with_blank_and_step end def test_select_minute_nil_with_blank - expected = %(\n).dup 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" @@ -697,7 +697,7 @@ def test_select_minute_nil_with_blank end def test_select_minute_nil_with_blank_and_step - expected = %(\n).dup expected << %(\n\n\n\n\n) expected << "\n" @@ -713,7 +713,7 @@ def test_select_minute_with_hidden_and_field_name end def test_select_minute_with_html_options - expected = %(\n).dup 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" @@ -721,7 +721,7 @@ def test_select_minute_with_html_options end def test_select_minute_with_default_prompt - expected = %(\n).dup 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" @@ -729,7 +729,7 @@ def test_select_minute_with_default_prompt end def test_select_minute_with_custom_prompt - expected = %(\n).dup 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" @@ -737,7 +737,7 @@ def test_select_minute_with_custom_prompt end def test_select_minute_with_generic_with_css_classes - expected = %(\n).dup 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" @@ -745,7 +745,7 @@ def test_select_minute_with_generic_with_css_classes end def test_select_minute_with_custom_with_css_classes - expected = %(\n).dup 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" @@ -753,7 +753,7 @@ def test_select_minute_with_custom_with_css_classes end def test_select_second - expected = %(\n).dup 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" @@ -761,7 +761,7 @@ def test_select_second end def test_select_second_with_disabled - expected = %(\n).dup 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" @@ -769,7 +769,7 @@ def test_select_second_with_disabled end def test_select_second_with_field_name_override - expected = %(\n).dup 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" @@ -777,7 +777,7 @@ def test_select_second_with_field_name_override end def test_select_second_with_blank - expected = %(\n).dup 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" @@ -785,7 +785,7 @@ def test_select_second_with_blank end def test_select_second_nil_with_blank - expected = %(\n).dup 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" @@ -793,7 +793,7 @@ def test_select_second_nil_with_blank end def test_select_second_with_html_options - expected = %(\n).dup 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" @@ -801,7 +801,7 @@ def test_select_second_with_html_options end def test_select_second_with_default_prompt - expected = %(\n).dup 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" @@ -809,7 +809,7 @@ def test_select_second_with_default_prompt end def test_select_second_with_custom_prompt - expected = %(\n).dup 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" @@ -817,7 +817,7 @@ def test_select_second_with_custom_prompt end def test_select_second_with_generic_with_css_classes - expected = %(\n).dup 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" @@ -825,7 +825,7 @@ def test_select_second_with_generic_with_css_classes end def test_select_second_with_custom_with_css_classes - expected = %(\n).dup 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" @@ -833,7 +833,7 @@ def test_select_second_with_custom_with_css_classes end def test_select_date - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -858,7 +858,7 @@ def test_select_date_can_have_more_then_1000_years_interval_if_forced_via_parame end def test_select_date_with_order - expected = %(\n).dup expected << %(\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" @@ -875,7 +875,7 @@ def test_select_date_with_order def test_select_date_with_incomplete_order # Since the order is incomplete nothing will be shown - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -883,7 +883,7 @@ def test_select_date_with_incomplete_order end def test_select_date_with_disabled - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -899,7 +899,7 @@ def test_select_date_with_disabled end def test_select_date_with_no_start_year - expected = %(\n).dup (Date.today.year - 5).upto(Date.today.year + 1) do |y| if y == Date.today.year expected << %(\n) @@ -923,7 +923,7 @@ def test_select_date_with_no_start_year end def test_select_date_with_no_end_year - expected = %(\n).dup 2003.upto(2008) do |y| if y == 2003 expected << %(\n) @@ -947,7 +947,7 @@ def test_select_date_with_no_end_year end def test_select_date_with_no_start_or_end_year - expected = %(\n).dup (Date.today.year - 5).upto(Date.today.year + 5) do |y| if y == Date.today.year expected << %(\n) @@ -971,7 +971,7 @@ def test_select_date_with_no_start_or_end_year end def test_select_date_with_zero_value - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -987,7 +987,7 @@ def test_select_date_with_zero_value end def test_select_date_with_zero_value_and_no_start_year - expected = %(\n).dup (Date.today.year - 5).upto(Date.today.year + 1) { |y| expected << %(\n) } expected << "\n" @@ -1003,7 +1003,7 @@ def test_select_date_with_zero_value_and_no_start_year end def test_select_date_with_zero_value_and_no_end_year - expected = %(\n).dup last_year = Time.now.year + 5 2003.upto(last_year) { |y| expected << %(\n) } expected << "\n" @@ -1020,7 +1020,7 @@ def test_select_date_with_zero_value_and_no_end_year end def test_select_date_with_zero_value_and_no_start_and_end_year - expected = %(\n).dup (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" @@ -1036,7 +1036,7 @@ def test_select_date_with_zero_value_and_no_start_and_end_year end def test_select_date_with_nil_value_and_no_start_and_end_year - expected = %(\n).dup (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" @@ -1052,7 +1052,7 @@ def test_select_date_with_nil_value_and_no_start_and_end_year end def test_select_date_with_html_options - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1068,7 +1068,7 @@ def test_select_date_with_html_options end def test_select_date_with_separator - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1088,7 +1088,7 @@ def test_select_date_with_separator end def test_select_date_with_separator_and_discard_day - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1104,7 +1104,7 @@ def test_select_date_with_separator_and_discard_day end def test_select_date_with_separator_discard_month_and_day - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1115,7 +1115,7 @@ def test_select_date_with_separator_discard_month_and_day end def test_select_date_with_hidden - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1124,7 +1124,7 @@ def test_select_date_with_hidden end def test_select_date_with_css_classes_option - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1140,7 +1140,7 @@ def test_select_date_with_css_classes_option end def test_select_date_with_custom_with_css_classes - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1156,7 +1156,7 @@ def test_select_date_with_custom_with_css_classes end def test_select_date_with_css_classes_option_and_html_class_option - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1172,7 +1172,7 @@ def test_select_date_with_css_classes_option_and_html_class_option end def test_select_date_with_custom_with_css_classes_and_html_class_option - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1188,7 +1188,7 @@ def test_select_date_with_custom_with_css_classes_and_html_class_option end def test_select_date_with_partial_with_css_classes_and_html_class_option - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1204,7 +1204,7 @@ def test_select_date_with_partial_with_css_classes_and_html_class_option end def test_select_date_with_html_class_option - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1220,7 +1220,7 @@ def test_select_date_with_html_class_option end def test_select_datetime - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1248,7 +1248,7 @@ def test_select_datetime end def test_select_datetime_with_ampm - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1276,7 +1276,7 @@ def test_select_datetime_with_ampm end def test_select_datetime_with_separators - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1304,7 +1304,7 @@ def test_select_datetime_with_separators end def test_select_datetime_with_nil_value_and_no_start_and_end_year - expected = %(\n).dup (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" @@ -1332,7 +1332,7 @@ def test_select_datetime_with_nil_value_and_no_start_and_end_year end def test_select_datetime_with_html_options - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1360,7 +1360,7 @@ def test_select_datetime_with_html_options end def test_select_datetime_with_all_separators - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1396,7 +1396,7 @@ def test_select_datetime_should_work_with_date end def test_select_datetime_with_default_prompt - expected = %(\n).dup expected << %(\n\n\n\n) expected << "\n" @@ -1425,7 +1425,7 @@ def test_select_datetime_with_default_prompt end def test_select_datetime_with_custom_prompt - expected = %(\n).dup expected << %(\n\n\n\n) expected << "\n" @@ -1454,7 +1454,7 @@ def test_select_datetime_with_custom_prompt end def test_select_datetime_with_generic_with_css_classes - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1482,7 +1482,7 @@ def test_select_datetime_with_generic_with_css_classes end def test_select_datetime_with_custom_with_css_classes - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1510,7 +1510,7 @@ def test_select_datetime_with_custom_with_css_classes end def test_select_datetime_with_custom_hours - expected = %(\n).dup expected << %(\n\n\n\n) expected << "\n" @@ -1539,7 +1539,7 @@ def test_select_datetime_with_custom_hours end def test_select_datetime_with_hidden - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) expected << %(\n) @@ -1551,7 +1551,7 @@ def test_select_datetime_with_hidden end def test_select_time - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1570,7 +1570,7 @@ def test_select_time end def test_select_time_with_ampm - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1588,7 +1588,7 @@ def test_select_time_with_ampm end def test_select_time_with_separator - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) expected << %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1630,7 +1630,7 @@ def test_select_time_with_seconds end def test_select_time_with_seconds_and_separator - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1654,7 +1654,7 @@ def test_select_time_with_seconds_and_separator end def test_select_time_with_html_options - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1677,7 +1677,7 @@ def test_select_time_should_work_with_date end def test_select_time_with_default_prompt - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1701,7 +1701,7 @@ def test_select_time_with_default_prompt end def test_select_time_with_custom_prompt - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1726,7 +1726,7 @@ def test_select_time_with_custom_prompt end def test_select_time_with_generic_with_css_classes - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1750,7 +1750,7 @@ def test_select_time_with_generic_with_css_classes end def test_select_time_with_custom_with_css_classes - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1774,7 +1774,7 @@ def test_select_time_with_custom_with_css_classes end def test_select_time_with_hidden - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) expected << %(\n) @@ -1788,7 +1788,7 @@ def test_date_select @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -1808,7 +1808,7 @@ def test_date_select_with_selected @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -1828,7 +1828,7 @@ def test_date_select_with_selected_in_hash @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -1866,7 +1866,7 @@ def test_date_select_without_day @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = "\n" + expected = "\n".dup expected << %{\n" + expected = "\n".dup expected << "\n" expected << %{\n" + expected = "\n".dup expected << %{\n" + expected = "\n".dup expected << %{\n\n\n\n\n\n\n\n\n\n\n\n\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -1953,7 +1953,7 @@ def test_date_select_within_fields_for_with_index concat f.date_select(:written_on) end - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -1969,7 +1969,7 @@ def test_date_select_within_fields_for_with_blank_index concat f.date_select(:written_on) end - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -1981,7 +1981,7 @@ def test_date_select_with_index @post.written_on = Date.new(2004, 6, 15) id = 456 - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2001,7 +2001,7 @@ def test_date_select_with_auto_index @post.written_on = Date.new(2004, 6, 15) id = 123 - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2020,7 +2020,7 @@ def test_date_select_with_different_order @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n}.dup 1.upto(31) { |i| expected << %(\n) } expected << "\n" @@ -2040,7 +2040,7 @@ def test_date_select_with_nil start_year = Time.now.year - 5 end_year = Time.now.year + 5 - expected = %{\n}.dup start_year.upto(end_year) { |i| expected << %(\n) } expected << "\n" @@ -2060,7 +2060,7 @@ def test_date_select_with_nil_and_blank start_year = Time.now.year - 5 end_year = Time.now.year + 5 - expected = %{\n}.dup expected << "\n" start_year.upto(end_year) { |i| expected << %(\n) } expected << "\n" @@ -2104,7 +2104,7 @@ def test_date_select_with_nil_and_blank_and_discard_month start_year = Time.now.year - 5 end_year = Time.now.year + 5 - expected = %{\n}.dup expected << "\n" start_year.upto(end_year) { |i| expected << %(\n) } expected << "\n" @@ -2136,7 +2136,7 @@ def test_date_select_cant_override_discard_hour @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2155,7 +2155,7 @@ def test_date_select_with_html_options @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2179,7 +2179,7 @@ def test_date_select_with_html_options_within_fields_for concat f.date_select(:written_on, {}, class: "selector") end - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2199,7 +2199,7 @@ def test_date_select_with_separator @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2223,7 +2223,7 @@ def test_date_select_with_separator_and_order @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n}.dup 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" @@ -2246,7 +2246,7 @@ def test_date_select_with_separator_and_order_and_year_discarded @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n}.dup 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" @@ -2264,7 +2264,7 @@ def test_date_select_with_default_prompt @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2284,7 +2284,7 @@ def test_date_select_with_custom_prompt @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2304,7 +2304,7 @@ def test_date_select_with_generic_with_css_classes @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2324,7 +2324,7 @@ def test_date_select_with_custom_with_css_classes @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2344,7 +2344,7 @@ def test_time_select @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -2363,7 +2363,7 @@ def test_time_select_with_selected @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -2382,7 +2382,7 @@ def test_time_select_with_selected_nil @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -2401,7 +2401,7 @@ def test_time_select_without_date_hidden_fields @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %(\n).dup 0.upto(23) { |i| expected << %(\n) } expected << "\n" expected << " : " @@ -2416,7 +2416,7 @@ def test_time_select_with_seconds @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -2439,7 +2439,7 @@ def test_time_select_with_html_options @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -2462,7 +2462,7 @@ def test_time_select_with_html_options_within_fields_for concat f.time_select(:written_on, {}, class: "selector") end - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -2481,7 +2481,7 @@ def test_time_select_with_separator @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -2508,7 +2508,7 @@ def test_time_select_with_default_prompt @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -2529,7 +2529,7 @@ def test_time_select_with_custom_prompt @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -2550,7 +2550,7 @@ def test_time_select_with_generic_with_css_classes @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -2571,7 +2571,7 @@ def test_time_select_with_custom_with_css_classes @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -2592,7 +2592,7 @@ def test_time_select_with_disabled_html_option @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -2611,7 +2611,7 @@ def test_datetime_select @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 16, 35) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2640,7 +2640,7 @@ def test_datetime_select_with_selected @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 16, 35) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2706,7 +2706,7 @@ def test_datetime_select_defaults_to_time_zone_now_when_config_time_zone_is_set @post = Post.new - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2741,7 +2741,7 @@ def test_datetime_select_with_html_options_within_fields_for concat f.datetime_select(:updated_at, {}, class: "selector") end - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} expected << %{ — \n} @@ -2754,7 +2754,7 @@ def test_datetime_select_with_separators @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2807,7 +2807,7 @@ def test_datetime_select_with_default_prompt @post = Post.new @post.updated_at = nil - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2836,7 +2836,7 @@ def test_datetime_select_with_custom_prompt @post = Post.new @post.updated_at = nil - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2865,7 +2865,7 @@ def test_datetime_select_with_generic_with_css_classes @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2894,7 +2894,7 @@ def test_datetime_select_with_custom_with_css_classes @post = Post.new @post.written_on = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2920,7 +2920,7 @@ def test_datetime_select_with_custom_with_css_classes end def test_date_select_with_zero_value_and_no_start_year - expected = %(\n).dup (Date.today.year - 5).upto(Date.today.year + 1) { |y| expected << %(\n) } expected << "\n" @@ -2936,7 +2936,7 @@ def test_date_select_with_zero_value_and_no_start_year end def test_date_select_with_zero_value_and_no_end_year - expected = %(\n).dup last_year = Time.now.year + 5 2003.upto(last_year) { |y| expected << %(\n) } expected << "\n" @@ -2953,7 +2953,7 @@ def test_date_select_with_zero_value_and_no_end_year end def test_date_select_with_zero_value_and_no_start_and_end_year - expected = %(\n).dup (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" @@ -2969,7 +2969,7 @@ def test_date_select_with_zero_value_and_no_start_and_end_year end def test_date_select_with_nil_value_and_no_start_and_end_year - expected = %(\n).dup (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" @@ -2985,7 +2985,7 @@ def test_date_select_with_nil_value_and_no_start_and_end_year end def test_datetime_select_with_nil_value_and_no_start_and_end_year - expected = %(\n).dup (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" @@ -3017,7 +3017,7 @@ def test_datetime_select_with_options_index @post.updated_at = Time.local(2004, 6, 15, 16, 35) id = 456 - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -3051,7 +3051,7 @@ def test_datetime_select_within_fields_for_with_options_index concat f.datetime_select(:updated_at) end - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -3081,7 +3081,7 @@ def test_datetime_select_with_auto_index @post.updated_at = Time.local(2004, 6, 15, 16, 35) id = @post.id - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -3110,7 +3110,7 @@ def test_datetime_select_with_seconds @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup 1999.upto(2009) { |i| expected << %(\n) } expected << "\n" expected << %{\n} + expected = %{\n}.dup expected << %{\n" @@ -3166,7 +3166,7 @@ def test_datetime_select_discard_month @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup 1999.upto(2009) { |i| expected << %(\n) } expected << "\n" expected << %{\n} @@ -3189,7 +3189,7 @@ def test_datetime_select_discard_year_and_month @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -3208,7 +3208,7 @@ def test_datetime_select_discard_year_and_month_with_disabled_html_option @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -3227,7 +3227,7 @@ def test_datetime_select_discard_hour @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) - expected = %{\n}.dup 1999.upto(2009) { |i| expected << %(\n) } expected << "\n" expected << %{\n} + expected = %{\n" expected << %{\n} + expected = %{\n" expected << %{\n} + expected = %{\n" expected << %{\n} + expected = %{\n}.dup expected << %{\n" @@ -3344,7 +3344,7 @@ def test_datetime_select_with_default_value_as_time @post = Post.new @post.updated_at = nil - expected = %{\n}.dup 2001.upto(2011) { |i| expected << %(\n) } expected << "\n" expected << %{\n} + expected = %{\n" @@ -3391,7 +3391,7 @@ def test_datetime_select_with_default_value_as_hash @post = Post.new @post.updated_at = nil - expected = %{\n}.dup (Time.now.year - 5).upto(Time.now.year + 5) { |i| expected << %(\n) } expected << "\n" expected << %{\n} + 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 ecdd5ce672..df81315b9c 100644 --- a/actionview/test/template/form_helper/form_with_test.rb +++ b/actionview/test/template/form_helper/form_with_test.rb @@ -16,7 +16,7 @@ def hidden_fields(options = {}) method = options[:method] skip_enforcing_utf8 = options.fetch(:skip_enforcing_utf8, false) - "".tap do |txt| + "".dup.tap do |txt| unless skip_enforcing_utf8 txt << %{} end @@ -32,7 +32,7 @@ def form_text(action = "http://www.example.com", local: false, **options) method = method.to_s == "get" ? "get" : "post" - txt = %{} + txt = %{}.dup end if method && !%w(get post).include?(method.to_s) @@ -2207,7 +2207,7 @@ def hidden_fields(options = {}) end def form_text(action = "/", id = nil, html_class = nil, local = nil, multipart = nil, method = nil) - txt = %{} + txt = %{}.dup else - txt = "" + txt = "".dup end if method && !%w(get post).include?(method.to_s) @@ -3459,7 +3459,7 @@ def hidden_fields(options = {}) end def form_text(action = "/", id = nil, html_class = nil, remote = nil, multipart = nil, method = nil) - txt = %{} end @@ -30,7 +30,7 @@ def form_text(action = "http://www.example.com", options = {}) method = method.to_s == "get" ? "get" : "post" - txt = %{ tags), escape_javascript(%(dont tags)) - 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 %(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 %(dont <\\/close> tags), j(%(dont tags)) end diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 9999607067..1fd8b4fe1a 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -439,7 +439,7 @@ def test_render_fallbacks_to_erb_for_unknown_types end CustomHandler = lambda do |template| - "@output_buffer = ''\n" \ + "@output_buffer = ''.dup\n" \ "@output_buffer << 'source: #{template.source.inspect}'\n" end @@ -583,7 +583,7 @@ def test_render_layout_with_object 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!", type: :foo1), @view.render(inline: "Hello, World!", type: :foo2) + assert_equal @view.render(inline: "Hello, World!".dup, type: :foo1), @view.render(inline: "Hello, World!".dup, 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 6ce66a1275..41b9063417 100644 --- a/actionview/test/template/streaming_render_test.rb +++ b/actionview/test/template/streaming_render_test.rb @@ -17,7 +17,7 @@ def render_body(options) def buffered_render(options) body = render_body(options) - string = "" + string = "".dup body.each do |piece| string << piece end diff --git a/actionview/test/template/template_test.rb b/actionview/test/template/template_test.rb index 9d31a98703..dd131f0246 100644 --- a/actionview/test/template/template_test.rb +++ b/actionview/test/template/template_test.rb @@ -53,7 +53,7 @@ def my_buffer end def new_template(body = "<%= hello %>", details = { format: :html }) - ActionView::Template.new(body, "hello template", details.fetch(:handler) { ERBHandler }, { virtual_path: "hello" }.merge!(details)) + ActionView::Template.new(body.dup, "hello template", details.fetch(:handler) { ERBHandler }, { virtual_path: "hello" }.merge!(details)) end def render(locals = {}) diff --git a/actionview/test/template/text_helper_test.rb b/actionview/test/template/text_helper_test.rb index 251c98230f..21ee4cc8e5 100644 --- a/actionview/test/template/text_helper_test.rb +++ b/actionview/test/template/text_helper_test.rb @@ -11,7 +11,7 @@ def setup end def test_concat - self.output_buffer = "foo" + self.output_buffer = "foo".dup assert_equal "foobar", concat("bar") assert_equal "foobar", output_buffer end @@ -104,8 +104,8 @@ def test_truncate_with_options_hash end def test_truncate_multibyte - 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) + 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) end def test_truncate_does_not_modify_the_options_hash @@ -325,7 +325,7 @@ def test_excerpt_with_omission end def test_excerpt_with_utf8 - 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)) + 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)) 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 30dc719ce6..b818e28483 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -535,7 +535,7 @@ def test_current_page_with_escaped_params def test_current_page_with_escaped_params_with_different_encoding @request = request_for_url("/") - @request.stub(:path, "/category/administra%c3%a7%c3%a3o".force_encoding(Encoding::ASCII_8BIT)) do + @request.stub(:path, "/category/administra%c3%a7%c3%a3o".dup.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 -- GitLab