From 9ca712348e547815d04a6e1e13b9faf71ebce987 Mon Sep 17 00:00:00 2001 From: Patrick Toomey Date: Thu, 9 Mar 2017 23:06:18 -0700 Subject: Prevent event propogation if element is disabled when event chain begins. The existing UJS event behavior relies on browsers not sending events for various events when an element is disabled. For example, imagine the following: The above button is disabled, so browsers will not trigger a click event and all UJS behavior is prevented. However, imagine a button like this: The above is treated differently by browsers such as Chrome/Safari. These browsers do not consider the strong tag to be disabled, and will trigger click events. UJS has logic to walk up the DOM to find an associated element subject to UJS behavior. But, this logic does not take into account the disabled status of the element. I originally thought we could simply change the selectors used to match elements to ignore disabled elements. However, UJS disables some elements as part of the event chain. So, an element might match early in the chain and then fail to match later. Instead of changing the selectors I added a callback to the chain that calls `stopEverything` if an element is disabled when the event chain begins. --- .../app/assets/javascripts/features/disable.coffee | 4 ++++ actionview/app/assets/javascripts/rails-ujs.coffee | 7 +++++- actionview/test/ujs/public/test/data-confirm.js | 28 ++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) (limited to 'actionview') diff --git a/actionview/app/assets/javascripts/features/disable.coffee b/actionview/app/assets/javascripts/features/disable.coffee index e8cce7da40..90aa3bdf0e 100644 --- a/actionview/app/assets/javascripts/features/disable.coffee +++ b/actionview/app/assets/javascripts/features/disable.coffee @@ -2,6 +2,10 @@ { matches, getData, setData, stopEverything, formElements } = Rails +Rails.handleDisabledElement = (e) -> + element = this + stopEverything(e) if element.disabled + # Unified function to enable an element (link, button and form) Rails.enableElement = (e) -> element = if e instanceof Event then e.target else e diff --git a/actionview/app/assets/javascripts/rails-ujs.coffee b/actionview/app/assets/javascripts/rails-ujs.coffee index df889ce067..afe7d6f7a3 100644 --- a/actionview/app/assets/javascripts/rails-ujs.coffee +++ b/actionview/app/assets/javascripts/rails-ujs.coffee @@ -12,7 +12,7 @@ fire, delegate getData, $ refreshCSRFTokens, CSRFProtection - enableElement, disableElement + enableElement, disableElement, handleDisabledElement handleConfirm handleRemote, formSubmitButtonClick, handleMetaClick handleMethod @@ -44,19 +44,23 @@ Rails.start = -> delegate document, Rails.buttonDisableSelector, 'ajax:complete', enableElement delegate document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement + delegate document, Rails.linkClickSelector, 'click', handleDisabledElement delegate document, Rails.linkClickSelector, 'click', handleConfirm delegate document, Rails.linkClickSelector, 'click', handleMetaClick delegate document, Rails.linkClickSelector, 'click', disableElement delegate document, Rails.linkClickSelector, 'click', handleRemote delegate document, Rails.linkClickSelector, 'click', handleMethod + delegate document, Rails.buttonClickSelector, 'click', handleDisabledElement delegate document, Rails.buttonClickSelector, 'click', handleConfirm delegate document, Rails.buttonClickSelector, 'click', disableElement delegate document, Rails.buttonClickSelector, 'click', handleRemote + delegate document, Rails.inputChangeSelector, 'change', handleDisabledElement delegate document, Rails.inputChangeSelector, 'change', handleConfirm delegate document, Rails.inputChangeSelector, 'change', handleRemote + delegate document, Rails.formSubmitSelector, 'submit', handleDisabledElement delegate document, Rails.formSubmitSelector, 'submit', handleConfirm delegate document, Rails.formSubmitSelector, 'submit', handleRemote # Normal mode submit @@ -65,6 +69,7 @@ Rails.start = -> delegate document, Rails.formSubmitSelector, 'ajax:send', disableElement delegate document, Rails.formSubmitSelector, 'ajax:complete', enableElement + delegate document, Rails.formInputClickSelector, 'click', handleDisabledElement delegate document, Rails.formInputClickSelector, 'click', handleConfirm delegate document, Rails.formInputClickSelector, 'click', formSubmitButtonClick diff --git a/actionview/test/ujs/public/test/data-confirm.js b/actionview/test/ujs/public/test/data-confirm.js index 28190c2250..229b9e1466 100644 --- a/actionview/test/ujs/public/test/data-confirm.js +++ b/actionview/test/ujs/public/test/data-confirm.js @@ -26,6 +26,13 @@ module('data-confirm', { 'data-confirm': 'Are you absolutely sure?' })) + $('#qunit-fixture').append($('" \ "" -- cgit v1.2.3 From 29595387c778a2398e48756fe7ba3d0878bc073d Mon Sep 17 00:00:00 2001 From: Edouard CHIN Date: Sun, 23 Apr 2017 22:30:49 -0400 Subject: `sort_query_string_params` method is no more used - This method was added in this commit https://github.com/rails/rails/commit/33258d713a4bc20b71e92fd656c923a7b189cd33 - The last caller got removed there https://github.com/rails/rails/commit/0b6ce3422370647cad3e91263a291f69b313d65b --- actionview/test/template/url_helper_test.rb | 7 ------- 1 file changed, 7 deletions(-) (limited to 'actionview') diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb index a6444a1686..c5c0349fb6 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -676,13 +676,6 @@ class UrlHelperTest < ActiveSupport::TestCase def request_forgery_protection_token "form_token" end - - private - def sort_query_string_params(uri) - path, qs = uri.split("?") - qs = qs.split("&").sort.join("&") if qs - qs ? "#{path}?#{qs}" : path - end end class UrlHelperControllerTest < ActionController::TestCase -- cgit v1.2.3 From 615fd399cd3c0e2f10874f21af89ac584dd0a0ba Mon Sep 17 00:00:00 2001 From: Edouard CHIN Date: Sun, 23 Apr 2017 22:20:55 -0400 Subject: Fix `current_page?` regression: - `check_parameters` kwargs was added to the `current_page?` method, the implementation was assuming only hashes responds to `delete`. This was causing issues when `current_page?` was called with a Active Model object - ref https://github.com/rails/rails/pull/27549 - Fixes #28846 --- actionview/lib/action_view/helpers/url_helper.rb | 2 +- actionview/test/template/url_helper_test.rb | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb index 70fc57c35f..a6857101b9 100644 --- a/actionview/lib/action_view/helpers/url_helper.rb +++ b/actionview/lib/action_view/helpers/url_helper.rb @@ -542,7 +542,7 @@ module ActionView return false unless request.get? || request.head? - check_parameters ||= !options.is_a?(String) && options.try(:delete, :check_parameters) + check_parameters ||= options.is_a?(Hash) && options.delete(:check_parameters) url_string = URI.parser.unescape(url_for(options)).force_encoding(Encoding::BINARY) # We ignore any extra parameters in the request_uri if the diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb index a6444a1686..fc02ffb7c3 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -509,6 +509,12 @@ class UrlHelperTest < ActiveSupport::TestCase assert !current_page?("http://www.example.com/", check_parameters: true) end + def test_current_page_considering_params_when_options_does_not_respond_to_to_hash + @request = request_for_url("/?order=desc&page=1") + + assert !current_page?(:back, check_parameters: false) + end + def test_current_page_with_params_that_match @request = request_for_url("/?order=desc&page=1") @@ -880,6 +886,11 @@ class WorkshopsController < ActionController::Base @workshop = Workshop.new(params[:id]) render inline: "<%= url_for(@workshop) %>\n<%= link_to('Workshop', @workshop) %>" end + + def edit + @workshop = Workshop.new(params[:id]) + render inline: "<%= current_page?(@workshop) %>" + end end class SessionsController < ActionController::Base @@ -944,4 +955,11 @@ class PolymorphicControllerTest < ActionController::TestCase get :edit, params: { workshop_id: 1, id: 1, format: "json" } assert_equal %{/workshops/1/sessions/1.json\nSession}, @response.body end + + def test_current_page_when_options_does_not_respond_to_to_hash + @controller = WorkshopsController.new + + get :edit, params: { id: 1 } + assert_equal "false", @response.body + end end -- cgit v1.2.3 From 756de667ae9a4b17a7ab6c7e4b17e73e67c27cba Mon Sep 17 00:00:00 2001 From: Jay Hayes Date: Thu, 25 Jun 2015 17:54:32 -0500 Subject: Ensure input to distance_of_time_in_words is not nil * Internally all input is converted to time so that it can be treated uniformly. Remove now-unneeded condition * Now that all input is treated is converted to time, we no longer need to type check it. Rename variables to clarify their purpose Extract private method to normalize distance_of_time args to time Update actionview changelog --- actionview/CHANGELOG.md | 5 +++ actionview/lib/action_view/helpers/date_helper.rb | 44 +++++++++++++---------- actionview/test/template/date_helper_test.rb | 10 ++++++ 3 files changed, 41 insertions(+), 18 deletions(-) (limited to 'actionview') diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md index c514e757c8..1fc38e76b2 100644 --- a/actionview/CHANGELOG.md +++ b/actionview/CHANGELOG.md @@ -1 +1,6 @@ +* Update distance_of_time_in_words helper to display better error messages + for bad input. + + *Jay Hayes* + Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/actionview/CHANGELOG.md) for previous changes. diff --git a/actionview/lib/action_view/helpers/date_helper.rb b/actionview/lib/action_view/helpers/date_helper.rb index 09dc6ef6bd..3f43465aa4 100644 --- a/actionview/lib/action_view/helpers/date_helper.rb +++ b/actionview/lib/action_view/helpers/date_helper.rb @@ -95,8 +95,8 @@ module ActionView scope: :'datetime.distance_in_words' }.merge!(options) - from_time = from_time.to_time if from_time.respond_to?(:to_time) - to_time = to_time.to_time if to_time.respond_to?(:to_time) + from_time = normalize_distance_of_time_argument_to_time(from_time) + to_time = normalize_distance_of_time_argument_to_time(to_time) from_time, to_time = to_time, from_time if from_time > to_time distance_in_minutes = ((to_time - from_time) / 60.0).round distance_in_seconds = (to_time - from_time).round @@ -130,22 +130,18 @@ module ActionView # 60 days up to 365 days when 86400...525600 then locale.t :x_months, count: (distance_in_minutes.to_f / 43200.0).round else - if from_time.acts_like?(:time) && to_time.acts_like?(:time) - fyear = from_time.year - fyear += 1 if from_time.month >= 3 - tyear = to_time.year - tyear -= 1 if to_time.month < 3 - leap_years = (fyear > tyear) ? 0 : (fyear..tyear).count { |x| Date.leap?(x) } - minute_offset_for_leap_year = leap_years * 1440 - # Discount the leap year days when calculating year distance. - # e.g. if there are 20 leap year days between 2 dates having the same day - # and month then the based on 365 days calculation - # the distance in years will come out to over 80 years when in written - # English it would read better as about 80 years. - minutes_with_offset = distance_in_minutes - minute_offset_for_leap_year - else - minutes_with_offset = distance_in_minutes - end + from_year = from_time.year + from_year += 1 if from_time.month >= 3 + to_year = to_time.year + to_year -= 1 if to_time.month < 3 + leap_years = (from_year > to_year) ? 0 : (from_year..to_year).count { |x| Date.leap?(x) } + minute_offset_for_leap_year = leap_years * 1440 + # Discount the leap year days when calculating year distance. + # e.g. if there are 20 leap year days between 2 dates having the same day + # and month then the based on 365 days calculation + # the distance in years will come out to over 80 years when in written + # English it would read better as about 80 years. + minutes_with_offset = distance_in_minutes - minute_offset_for_leap_year remainder = (minutes_with_offset % MINUTES_IN_YEAR) distance_in_years = (minutes_with_offset.div MINUTES_IN_YEAR) if remainder < MINUTES_IN_QUARTER_YEAR @@ -687,6 +683,18 @@ module ActionView content_tag("time".freeze, content, options.reverse_merge(datetime: datetime), &block) end + + private + + def normalize_distance_of_time_argument_to_time(value) + if value.is_a?(Numeric) + Time.at(value) + elsif value.respond_to?(:to_time) + value.to_time + else + raise ArgumentError, "#{value.inspect} can't be converted to a Time value" + end + end end class DateTimeSelector #:nodoc: diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb index d257147e1f..a259752d6a 100644 --- a/actionview/test/template/date_helper_test.rb +++ b/actionview/test/template/date_helper_test.rb @@ -128,6 +128,16 @@ class DateHelperTest < ActionView::TestCase assert_distance_of_time_in_words(from) end + def test_distance_in_words_with_nil_input + assert_raises(ArgumentError) { distance_of_time_in_words(nil) } + assert_raises(ArgumentError) { distance_of_time_in_words(0, nil) } + end + + def test_distance_in_words_with_mixed_argument_types + assert_equal "1 minute", distance_of_time_in_words(0, Time.at(60)) + assert_equal "10 minutes", distance_of_time_in_words(Time.at(600), 0) + end + def test_distance_in_words_with_mathn_required # test we avoid Integer#/ (redefined by mathn) silence_warnings { require "mathn" } -- cgit v1.2.3 From 89389428b5d04e14f09009ac9af593d7c3da709f Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 30 Apr 2017 02:41:44 +0900 Subject: Cleanup CHANGELOGs [ci skip] * Remove trailing spaces. * Add backticks around method and command. * Fix indentation. --- actionview/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'actionview') diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md index 1fc38e76b2..d478f4c437 100644 --- a/actionview/CHANGELOG.md +++ b/actionview/CHANGELOG.md @@ -1,6 +1,7 @@ -* Update distance_of_time_in_words helper to display better error messages +* Update `distance_of_time_in_words` helper to display better error messages for bad input. *Jay Hayes* + Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/actionview/CHANGELOG.md) for previous changes. -- cgit v1.2.3 From b201474756a2ee493406ad0cb49f49c6873bdc28 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 7 May 2017 04:08:58 +0900 Subject: Should escape meta characters in regexp --- actionview/test/activerecord/controller_runtime_test.rb | 2 +- actionview/test/template/asset_tag_helper_test.rb | 6 +++--- actionview/test/template/atom_feed_helper_test.rb | 8 ++++---- actionview/test/template/render_test.rb | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'actionview') diff --git a/actionview/test/activerecord/controller_runtime_test.rb b/actionview/test/activerecord/controller_runtime_test.rb index 590559f592..1cec5072c0 100644 --- a/actionview/test/activerecord/controller_runtime_test.rb +++ b/actionview/test/activerecord/controller_runtime_test.rb @@ -67,7 +67,7 @@ class ControllerRuntimeLogSubscriberTest < ActionController::TestCase wait assert_equal 2, @logger.logged(:info).size - assert_match(/\(Views: [\d.]+ms \| ActiveRecord: 0.0ms\)/, @logger.logged(:info)[1]) + assert_match(/\(Views: [\d.]+ms \| ActiveRecord: 0\.0ms\)/, @logger.logged(:info)[1]) end def test_log_with_active_record_when_post diff --git a/actionview/test/template/asset_tag_helper_test.rb b/actionview/test/template/asset_tag_helper_test.rb index 07a6452cc1..b7a993c5c9 100644 --- a/actionview/test/template/asset_tag_helper_test.rb +++ b/actionview/test/template/asset_tag_helper_test.rb @@ -709,13 +709,13 @@ class AssetTagHelperNonVhostTest < ActionView::TestCase def test_should_wildcard_asset_host @controller.config.asset_host = "http://a%d.example.com" - assert_match(%r(http://a[0123].example.com), compute_asset_host("foo")) + assert_match(%r(http://a[0123]\.example\.com), compute_asset_host("foo")) end def test_should_wildcard_asset_host_between_zero_and_four @controller.config.asset_host = "http://a%d.example.com" - assert_match(%r(http://a[0123].example.com/collaboration/hieraki/images/xml.png), image_path("xml.png")) - assert_match(%r(http://a[0123].example.com/collaboration/hieraki/images/xml.png), image_url("xml.png")) + assert_match(%r(http://a[0123]\.example\.com/collaboration/hieraki/images/xml\.png), image_path("xml.png")) + assert_match(%r(http://a[0123]\.example\.com/collaboration/hieraki/images/xml\.png), image_url("xml.png")) end def test_asset_host_without_protocol_should_be_protocol_relative diff --git a/actionview/test/template/atom_feed_helper_test.rb b/actionview/test/template/atom_feed_helper_test.rb index 1245a1a966..7304b769a4 100644 --- a/actionview/test/template/atom_feed_helper_test.rb +++ b/actionview/test/template/atom_feed_helper_test.rb @@ -301,8 +301,8 @@ class AtomFeedTest < ActionController::TestCase with_restful_routing(:scrolls) do get :index, params: { id: "feed_with_atomPub_namespace" } assert_match %r{xml:lang="en-US"}, @response.body - assert_match %r{xmlns="http://www.w3.org/2005/Atom"}, @response.body - assert_match %r{xmlns:app="http://www.w3.org/2007/app"}, @response.body + assert_match %r{xmlns="http://www\.w3\.org/2005/Atom"}, @response.body + assert_match %r{xmlns:app="http://www\.w3\.org/2007/app"}, @response.body end end @@ -319,7 +319,7 @@ class AtomFeedTest < ActionController::TestCase with_restful_routing(:scrolls) do get :index, params: { id: "feed_with_xml_processing_instructions" } assert_match %r{<\?xml-stylesheet [^\?]*type="text/css"}, @response.body - assert_match %r{<\?xml-stylesheet [^\?]*href="t.css"}, @response.body + assert_match %r{<\?xml-stylesheet [^\?]*href="t\.css"}, @response.body end end @@ -334,7 +334,7 @@ class AtomFeedTest < ActionController::TestCase def test_feed_xhtml with_restful_routing(:scrolls) do get :index, params: { id: "feed_with_xhtml_content" } - assert_match %r{xmlns="http://www.w3.org/1999/xhtml"}, @response.body + assert_match %r{xmlns="http://www\.w3\.org/1999/xhtml"}, @response.body assert_select "summary", text: /Something Boring/ assert_select "summary", text: /after 2/ end diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 9f9882afee..3f66ab3ed3 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -27,7 +27,7 @@ module RenderTestCases def test_render_without_options e = assert_raises(ArgumentError) { @view.render() } - assert_match(/You invoked render but did not give any of (.+) option./, e.message) + assert_match(/You invoked render but did not give any of (.+) option\./, e.message) end def test_render_file @@ -261,7 +261,7 @@ module RenderTestCases def test_render_sub_template_with_errors e = assert_raises(ActionView::Template::Error) { @view.render(template: "test/sub_template_raise") } assert_match %r!method.*doesnt_exist!, e.message - assert_match %r{Trace of template inclusion: .*test/sub_template_raise.html.erb}, e.sub_template_message + assert_match %r{Trace of template inclusion: .*test/sub_template_raise\.html\.erb}, e.sub_template_message assert_equal "1", e.line_number assert_equal File.expand_path("#{FIXTURE_LOAD_PATH}/test/_raise.html.erb"), e.file_name end -- cgit v1.2.3 From 89e097fa46687706b0095db228bfe9d92de7e0ce Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Fri, 12 May 2017 15:37:40 +0900 Subject: Suppress `warning: assigned but unused variable - stdout` --- actionview/Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview') diff --git a/actionview/Rakefile b/actionview/Rakefile index de588ad25c..4f22ef84c8 100644 --- a/actionview/Rakefile +++ b/actionview/Rakefile @@ -119,7 +119,7 @@ namespace :assets do class Element {} require('#{dir}') JS - stdout, stderr, status = Open3.capture3("node", "--print", js) + _, stderr, status = Open3.capture3("node", "--print", js) if status.success? puts "[OK]" else -- cgit v1.2.3 From 4be50a4a455a027e228dbd8acf09e0fb786929ec Mon Sep 17 00:00:00 2001 From: Josh Goodall Date: Tue, 16 May 2017 20:21:18 +1000 Subject: Fix server-generated JS response processing on IE9 when using rails-ujs and remote: true --- actionview/app/assets/javascripts/rails-ujs/utils/ajax.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview') diff --git a/actionview/app/assets/javascripts/rails-ujs/utils/ajax.coffee b/actionview/app/assets/javascripts/rails-ujs/utils/ajax.coffee index 26df7b9a3f..a653d3af3d 100644 --- a/actionview/app/assets/javascripts/rails-ujs/utils/ajax.coffee +++ b/actionview/app/assets/javascripts/rails-ujs/utils/ajax.coffee @@ -14,7 +14,7 @@ AcceptHeaders = Rails.ajax = (options) -> options = prepareOptions(options) xhr = createXHR options, -> - response = processResponse(xhr.response, xhr.getResponseHeader('Content-Type')) + response = processResponse(xhr.response ? xhr.responseText, xhr.getResponseHeader('Content-Type')) if xhr.status // 100 == 2 options.success?(response, xhr.statusText, xhr) else -- cgit v1.2.3 From efe62b71d52c40849ead8855fb4f42fae91d4c54 Mon Sep 17 00:00:00 2001 From: Sam Pohlenz Date: Wed, 17 May 2017 13:03:27 +0930 Subject: Fix select tag helper used with Enumerable choices Allows a custom object implementing Enumerable to be used as the choices parameter for a select tag, which previously wasn't possible due to the call to `empty?` on the choices (which isn't implemented on Enumerable). --- actionview/lib/action_view/helpers/tags/select.rb | 2 +- actionview/test/template/form_options_helper_test.rb | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/helpers/tags/select.rb b/actionview/lib/action_view/helpers/tags/select.rb index 667c7e945a..9ff7e54e4f 100644 --- a/actionview/lib/action_view/helpers/tags/select.rb +++ b/actionview/lib/action_view/helpers/tags/select.rb @@ -33,7 +33,7 @@ module ActionView # [nil, []] # { nil => [] } def grouped_choices? - !@choices.empty? && @choices.first.respond_to?(:last) && Array === @choices.first.last + !@choices.blank? && @choices.first.respond_to?(:last) && Array === @choices.first.last end end end diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb index 258dcdb806..3247f20ba7 100644 --- a/actionview/test/template/form_options_helper_test.rb +++ b/actionview/test/template/form_options_helper_test.rb @@ -6,6 +6,15 @@ class Map < Hash end end +class CustomEnumerable + include Enumerable + + def each + yield "one" + yield "two" + end +end + class FormOptionsHelperTest < ActionView::TestCase tests ActionView::Helpers::FormOptionsHelper @@ -904,6 +913,14 @@ class FormOptionsHelperTest < ActionView::TestCase ) end + def test_select_with_enumerable + @post = Post.new + assert_dom_equal( + "", + select("post", "category", CustomEnumerable.new) + ) + end + def test_collection_select @post = Post.new @post.author_name = "Babe" -- cgit v1.2.3 From 75fa8dd309a84e125b59d01bf182d88419631eaa Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 18 May 2017 18:12:32 +0200 Subject: Use recyclable cache keys (#29092) --- actionview/lib/action_view/helpers/cache_helper.rb | 26 ++++++++++++++-------- .../partial_renderer/collection_caching.rb | 2 +- .../test/activerecord/relation_cache_test.rb | 2 +- actionview/test/template/log_subscriber_test.rb | 2 +- actionview/test/template/render_test.rb | 6 ++--- 5 files changed, 23 insertions(+), 15 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/helpers/cache_helper.rb b/actionview/lib/action_view/helpers/cache_helper.rb index 15ab7e304f..c3aecadcd6 100644 --- a/actionview/lib/action_view/helpers/cache_helper.rb +++ b/actionview/lib/action_view/helpers/cache_helper.rb @@ -8,10 +8,9 @@ module ActionView # fragments, and so on. This method takes a block that contains # the content you wish to cache. # - # The best way to use this is by doing key-based cache expiration - # on top of a cache store like Memcached that'll automatically - # kick out old entries. For more on key-based expiration, see: - # http://signalvnoise.com/posts/3113-how-key-based-cache-expiration-works + # The best way to use this is by doing recyclable key-based cache expiration + # on top of a cache store like Memcached or Redis that'll automatically + # kick out old entries. # # When using this method, you list the cache dependency as the name of the cache, like so: # @@ -23,10 +22,14 @@ module ActionView # This approach will assume that when a new topic is added, you'll touch # the project. The cache key generated from this call will be something like: # - # views/projects/123-20120806214154/7a1156131a6928cb0026877f8b749ac9 - # ^class ^id ^updated_at ^template tree digest + # views/template/action.html.erb:7a1156131a6928cb0026877f8b749ac9/projects/123 + # ^template path ^template tree digest ^class ^id # - # The cache is thus automatically bumped whenever the project updated_at is touched. + # This cache key is stable, but it's combined with a cache version derived from the project + # record. When the project updated_at is touched, the #cache_version changes, even + # if the key stays stable. This means that unlike a traditional key-based cache expiration + # approach, you won't be generating cache trash, unused keys, simply because the dependent + # record is updated. # # If your template cache depends on multiple sources (try to avoid this to keep things simple), # you can name all these dependencies as part of an array: @@ -217,10 +220,15 @@ module ActionView def fragment_name_with_digest(name, virtual_path) virtual_path ||= @virtual_path + if virtual_path name = controller.url_for(name).split("://").last if name.is_a?(Hash) - digest = Digestor.digest name: virtual_path, finder: lookup_context, dependencies: view_cache_dependencies - [ name, digest ] + + if digest = Digestor.digest(name: virtual_path, finder: lookup_context, dependencies: view_cache_dependencies).presence + [ "#{virtual_path}:#{digest}", name ] + else + [ virtual_path, name ] + end else name end diff --git a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb index 1fbe209200..847256ac78 100644 --- a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb +++ b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb @@ -38,7 +38,7 @@ module ActionView end def expanded_cache_key(key) - key = @view.fragment_cache_key(@view.cache_fragment_name(key, virtual_path: @template.virtual_path)) + key = @view.combined_fragment_cache_key(@view.cache_fragment_name(key, virtual_path: @template.virtual_path)) key.frozen? ? key.dup : key # #read_multi & #write may require mutability, Dalli 2.6.0. end diff --git a/actionview/test/activerecord/relation_cache_test.rb b/actionview/test/activerecord/relation_cache_test.rb index 43f7242ee9..fbab512c41 100644 --- a/actionview/test/activerecord/relation_cache_test.rb +++ b/actionview/test/activerecord/relation_cache_test.rb @@ -10,7 +10,7 @@ class RelationCacheTest < ActionView::TestCase def test_cache_relation_other cache(Project.all) { concat("Hello World") } - assert_equal "Hello World", controller.cache_store.read("views/projects-#{Project.count}/") + assert_equal "Hello World", controller.cache_store.read("views/path/projects-#{Project.count}") end def view_cache_dependencies; end diff --git a/actionview/test/template/log_subscriber_test.rb b/actionview/test/template/log_subscriber_test.rb index 7f358add7e..584666d54b 100644 --- a/actionview/test/template/log_subscriber_test.rb +++ b/actionview/test/template/log_subscriber_test.rb @@ -39,7 +39,7 @@ class AVLogSubscriberTest < ActiveSupport::TestCase def set_view_cache_dependencies def @view.view_cache_dependencies; []; end - def @view.fragment_cache_key(*); "ahoy `controller` dependency"; end + def @view.combined_fragment_cache_key(*); "ahoy `controller` dependency"; end end def test_render_file_template diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 3f66ab3ed3..fef78807d1 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -10,8 +10,8 @@ module RenderTestCases @view = Class.new(ActionView::Base) do def view_cache_dependencies; end - def fragment_cache_key(key) - ActiveSupport::Cache.expand_cache_key(key, :views) + def combined_fragment_cache_key(key) + [ :views, key ] end end.new(paths, @assigns) @@ -718,6 +718,6 @@ class CachedCollectionViewRenderTest < ActiveSupport::TestCase private def cache_key(*names, virtual_path) digest = ActionView::Digestor.digest name: virtual_path, finder: @view.lookup_context, dependencies: [] - @view.fragment_cache_key([ *names, digest ]) + @view.combined_fragment_cache_key([ "#{virtual_path}:#{digest}", *names ]) end end -- cgit v1.2.3 From f8b5b4af843cb3107071c7d9fdc0d76bb43c47d6 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 19 May 2017 20:19:46 +0900 Subject: ERB::Util.url_encode no longer escapes ~ since ruby 2.5 see: https://bugs.ruby-lang.org/issues/6696 --- actionview/test/template/url_helper_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionview') diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb index 6adfa95dd1..58d903b1c8 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -615,8 +615,8 @@ class UrlHelperTest < ActiveSupport::TestCase def test_mail_to_with_special_characters assert_dom_equal( - %{#!$%&'*+-/=?^_`{}|~@example.org}, - mail_to("#!$%&'*+-/=?^_`{}|~@example.org") + %{#!$%&'*+-/=?^_`{}|@example.org}, + mail_to("#!$%&'*+-/=?^_`{}|@example.org") ) end -- cgit v1.2.3 From f1a740ef3cadd2c6cc5ceceb6fd46e2e6825b12b Mon Sep 17 00:00:00 2001 From: Dmitriy Plekhanov Date: Fri, 19 May 2017 22:42:02 +0300 Subject: Check for jQuery ajax jQuery slim version doesn't have ajax, so if a person include this version ajaxFilter raises error. --- actionview/app/assets/javascripts/rails-ujs/start.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview') diff --git a/actionview/app/assets/javascripts/rails-ujs/start.coffee b/actionview/app/assets/javascripts/rails-ujs/start.coffee index 5746a22287..55595ac96f 100644 --- a/actionview/app/assets/javascripts/rails-ujs/start.coffee +++ b/actionview/app/assets/javascripts/rails-ujs/start.coffee @@ -9,7 +9,7 @@ } = Rails # For backward compatibility -if jQuery? and not jQuery.rails +if jQuery? and jQuery.ajax? and not jQuery.rails jQuery.rails = Rails jQuery.ajaxPrefilter (options, originalOptions, xhr) -> CSRFProtection(xhr) unless options.crossDomain -- cgit v1.2.3 From 062e5f2b068fbce74102d7301b58a3cd7c5da883 Mon Sep 17 00:00:00 2001 From: Mike Gunderloy Date: Sat, 20 May 2017 04:00:13 -0500 Subject: Add :json type to auto_discovery_link_tag This allows auto_discovery_link_tag to support the JSON Feed standard. See https://jsonfeed.org/version/1 for more information. --- actionview/CHANGELOG.md | 4 ++++ actionview/lib/action_view/helpers/asset_tag_helper.rb | 12 +++++++----- actionview/test/template/asset_tag_helper_test.rb | 1 + 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'actionview') diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md index d478f4c437..122c42c5bd 100644 --- a/actionview/CHANGELOG.md +++ b/actionview/CHANGELOG.md @@ -1,3 +1,7 @@ +* Add `:json` type to `auto_discovery_link_tag` to support [JSON Feeds](https://jsonfeed.org/version/1) + + *Mike Gunderloy* + * Update `distance_of_time_in_words` helper to display better error messages for bad input. diff --git a/actionview/lib/action_view/helpers/asset_tag_helper.rb b/actionview/lib/action_view/helpers/asset_tag_helper.rb index 750f96f29e..c21fe782c6 100644 --- a/actionview/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionview/lib/action_view/helpers/asset_tag_helper.rb @@ -122,9 +122,9 @@ module ActionView end # Returns a link tag that browsers and feed readers can use to auto-detect - # an RSS or Atom feed. The +type+ can either be :rss (default) or - # :atom. Control the link options in url_for format using the - # +url_options+. You can modify the LINK tag itself in +tag_options+. + # an RSS, Atom, or JSON feed. The +type+ can be :rss (default), + # :atom, or :json. Control the link options in url_for format + # using the +url_options+. You can modify the LINK tag itself in +tag_options+. # # ==== Options # @@ -138,6 +138,8 @@ module ActionView # # => # auto_discovery_link_tag(:atom) # # => + # auto_discovery_link_tag(:json) + # # => # auto_discovery_link_tag(:rss, {action: "feed"}) # # => # auto_discovery_link_tag(:rss, {action: "feed"}, {title: "My RSS"}) @@ -147,8 +149,8 @@ module ActionView # auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", {title: "Example RSS"}) # # => def auto_discovery_link_tag(type = :rss, url_options = {}, tag_options = {}) - if !(type == :rss || type == :atom) && tag_options[:type].blank? - raise ArgumentError.new("You should pass :type tag_option key explicitly, because you have passed #{type} type other than :rss or :atom.") + if !(type == :rss || type == :atom || type == :json) && tag_options[:type].blank? + raise ArgumentError.new("You should pass :type tag_option key explicitly, because you have passed #{type} type other than :rss, :atom, or :json.") end tag( diff --git a/actionview/test/template/asset_tag_helper_test.rb b/actionview/test/template/asset_tag_helper_test.rb index b7a993c5c9..6093a4e660 100644 --- a/actionview/test/template/asset_tag_helper_test.rb +++ b/actionview/test/template/asset_tag_helper_test.rb @@ -53,6 +53,7 @@ class AssetTagHelperTest < ActionView::TestCase %(auto_discovery_link_tag) => %(), %(auto_discovery_link_tag(:rss)) => %(), %(auto_discovery_link_tag(:atom)) => %(), + %(auto_discovery_link_tag(:json)) => %(), %(auto_discovery_link_tag(:rss, :action => "feed")) => %(), %(auto_discovery_link_tag(:rss, "http://localhost/feed")) => %(), %(auto_discovery_link_tag(:rss, "//localhost/feed")) => %(), -- cgit v1.2.3 From b0a258fa217551504a4e3399faf4a5fb868f2ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20=C5=A0im=C3=A1nek?= Date: Mon, 22 May 2017 09:57:00 +0200 Subject: Update test link in ActionView javascripts README.md. [ci skip] --- actionview/app/assets/javascripts/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview') diff --git a/actionview/app/assets/javascripts/README.md b/actionview/app/assets/javascripts/README.md index 92f3e8a3b3..399ebc7324 100644 --- a/actionview/app/assets/javascripts/README.md +++ b/actionview/app/assets/javascripts/README.md @@ -39,7 +39,7 @@ Require `rails-ujs` into your application.js manifest. How to run tests ------------ -Run `bundle exec rake ujs:server` first, and then run the web tests by visiting [[http://localhost:4567]] in your browser. +Run `bundle exec rake ujs:server` first, and then run the web tests by visiting http://localhost:4567 in your browser. ## License rails-ujs is released under the [MIT License](MIT-LICENSE). -- cgit v1.2.3 From 40bdbce191ad90dfea43dad51fac5c4726b89392 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Mon, 15 May 2017 14:17:28 +0000 Subject: Define path with __dir__ ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f --- actionview/Rakefile | 10 ++++------ actionview/actionview.gemspec | 2 +- actionview/lib/action_view.rb | 2 +- actionview/test/abstract_unit.rb | 14 +++++++------- .../test/actionpack/abstract/abstract_controller_test.rb | 4 ++-- actionview/test/actionpack/abstract/helper_test.rb | 4 ++-- actionview/test/actionpack/controller/capture_test.rb | 2 +- actionview/test/actionpack/controller/layout_test.rb | 6 +++--- actionview/test/actionpack/controller/render_test.rb | 12 ++++++------ actionview/test/active_record_unit.rb | 6 +++--- actionview/test/template/digestor_test.rb | 2 +- actionview/test/template/render_test.rb | 4 ++-- actionview/test/template/resolver_patterns_test.rb | 2 +- actionview/test/ujs/config.ru | 2 +- 14 files changed, 35 insertions(+), 37 deletions(-) (limited to 'actionview') diff --git a/actionview/Rakefile b/actionview/Rakefile index 4f22ef84c8..0fc38e8db4 100644 --- a/actionview/Rakefile +++ b/actionview/Rakefile @@ -2,8 +2,6 @@ require "rake/testtask" require "fileutils" require "open3" -dir = File.dirname(__FILE__) - desc "Default Task" task default: :test @@ -95,7 +93,7 @@ namespace :assets do desc "Verify compiled Action View assets" task :verify do file = "lib/assets/compiled/rails-ujs.js" - pathname = Pathname.new("#{dir}/#{file}") + pathname = Pathname.new("#{__dir__}/#{file}") print "[verify] #{file} exists " if pathname.exist? @@ -113,11 +111,11 @@ namespace :assets do fail end - print "[verify] #{dir} can be required as a module " + print "[verify] #{__dir__} can be required as a module " js = <<-JS window = { Event: class {} } class Element {} - require('#{dir}') + require('#{__dir__}') JS _, stderr, status = Open3.capture3("node", "--print", js) if status.success? @@ -130,7 +128,7 @@ namespace :assets do end task :lines do - load File.expand_path("..", File.dirname(__FILE__)) + "/tools/line_statistics" + load File.join(File.expand_path("..", __dir__), "/tools/line_statistics") files = FileList["lib/**/*.rb"] CodeTools::LineStatistics.new(files).print_loc end diff --git a/actionview/actionview.gemspec b/actionview/actionview.gemspec index cfaa5007a1..41221dd04e 100644 --- a/actionview/actionview.gemspec +++ b/actionview/actionview.gemspec @@ -1,4 +1,4 @@ -version = File.read(File.expand_path("../../RAILS_VERSION", __FILE__)).strip +version = File.read(File.expand_path("../RAILS_VERSION", __dir__)).strip Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY diff --git a/actionview/lib/action_view.rb b/actionview/lib/action_view.rb index ca586f1d52..99c5b831b5 100644 --- a/actionview/lib/action_view.rb +++ b/actionview/lib/action_view.rb @@ -92,5 +92,5 @@ end require "active_support/core_ext/string/output_safety" ActiveSupport.on_load(:i18n) do - I18n.load_path << "#{File.dirname(__FILE__)}/action_view/locale/en.yml" + I18n.load_path << File.expand_path("action_view/locale/en.yml", __dir__) end diff --git a/actionview/test/abstract_unit.rb b/actionview/test/abstract_unit.rb index dde66a7ba0..a7d706c5e1 100644 --- a/actionview/test/abstract_unit.rb +++ b/actionview/test/abstract_unit.rb @@ -1,8 +1,8 @@ -$:.unshift(File.dirname(__FILE__) + "/lib") -$:.unshift(File.dirname(__FILE__) + "/fixtures/helpers") -$:.unshift(File.dirname(__FILE__) + "/fixtures/alternate_helpers") +$:.unshift File.expand_path("lib", __dir__) +$:.unshift File.expand_path("fixtures/helpers", __dir__) +$:.unshift File.expand_path("fixtures/alternate_helpers", __dir__) -ENV["TMPDIR"] = File.join(File.dirname(__FILE__), "tmp") +ENV["TMPDIR"] = File.expand_path("tmp", __dir__) require "active_support/core_ext/kernel/reporting" @@ -47,7 +47,7 @@ I18n.backend.store_translations "da", {} I18n.backend.store_translations "pt-BR", {} ORIGINAL_LOCALES = I18n.available_locales.map(&:to_s).sort -FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), "fixtures") +FIXTURE_LOAD_PATH = File.expand_path("fixtures", __dir__) module RenderERBUtils def view @@ -133,7 +133,7 @@ class BasicController def config @config ||= ActiveSupport::InheritableOptions.new(ActionController::Base.config).tap do |config| # VIEW TODO: View tests should not require a controller - public_dir = File.expand_path("../fixtures/public", __FILE__) + public_dir = File.expand_path("fixtures/public", __dir__) config.assets_dir = public_dir config.javascripts_dir = "#{public_dir}/javascripts" config.stylesheets_dir = "#{public_dir}/stylesheets" @@ -196,7 +196,7 @@ class ActionDispatch::IntegrationTest < ActiveSupport::TestCase end def with_autoload_path(path) - path = File.join(File.dirname(__FILE__), "fixtures", path) + path = File.join(File.expand_path("fixtures", __dir__), path) if ActiveSupport::Dependencies.autoload_paths.include?(path) yield else diff --git a/actionview/test/actionpack/abstract/abstract_controller_test.rb b/actionview/test/actionpack/abstract/abstract_controller_test.rb index a2cd3deb58..8f65a61493 100644 --- a/actionview/test/actionpack/abstract/abstract_controller_test.rb +++ b/actionview/test/actionpack/abstract/abstract_controller_test.rb @@ -42,7 +42,7 @@ module AbstractController super end - append_view_path File.expand_path(File.join(File.dirname(__FILE__), "views")) + append_view_path File.expand_path("views", __dir__) end class Me2 < RenderingController @@ -152,7 +152,7 @@ module AbstractController class OverridingLocalPrefixes < AbstractController::Base include AbstractController::Rendering include ActionView::Rendering - append_view_path File.expand_path(File.join(File.dirname(__FILE__), "views")) + append_view_path File.expand_path("views", __dir__) def index render diff --git a/actionview/test/actionpack/abstract/helper_test.rb b/actionview/test/actionpack/abstract/helper_test.rb index 83237518d7..13922e4485 100644 --- a/actionview/test/actionpack/abstract/helper_test.rb +++ b/actionview/test/actionpack/abstract/helper_test.rb @@ -1,6 +1,6 @@ require "abstract_unit" -ActionController::Base.helpers_path = File.expand_path("../../../fixtures/helpers", __FILE__) +ActionController::Base.helpers_path = File.expand_path("../../fixtures/helpers", __dir__) module AbstractController module Testing @@ -51,7 +51,7 @@ module AbstractController class AbstractInvalidHelpers < AbstractHelpers include ActionController::Helpers - path = File.expand_path("../../../fixtures/helpers_missing", __FILE__) + path = File.expand_path("../../fixtures/helpers_missing", __dir__) $:.unshift(path) self.helpers_path = path end diff --git a/actionview/test/actionpack/controller/capture_test.rb b/actionview/test/actionpack/controller/capture_test.rb index f0ae609845..cc3a23c60c 100644 --- a/actionview/test/actionpack/controller/capture_test.rb +++ b/actionview/test/actionpack/controller/capture_test.rb @@ -2,7 +2,7 @@ require "abstract_unit" require "active_support/logger" class CaptureController < ActionController::Base - self.view_paths = [ File.dirname(__FILE__) + "/../../fixtures/actionpack" ] + self.view_paths = [ File.expand_path("../../fixtures/actionpack", __dir__) ] def self.controller_name; "test"; end def self.controller_path; "test"; end diff --git a/actionview/test/actionpack/controller/layout_test.rb b/actionview/test/actionpack/controller/layout_test.rb index b79835ff34..b3e0329f57 100644 --- a/actionview/test/actionpack/controller/layout_test.rb +++ b/actionview/test/actionpack/controller/layout_test.rb @@ -5,7 +5,7 @@ require "active_support/core_ext/array/extract_options" # method has access to the view_paths array when looking for a layout to automatically assign. old_load_paths = ActionController::Base.view_paths -ActionController::Base.view_paths = [ File.dirname(__FILE__) + "/../../fixtures/actionpack/layout_tests/" ] +ActionController::Base.view_paths = [ File.expand_path("../../fixtures/actionpack/layout_tests", __dir__) ] class LayoutTest < ActionController::Base def self.controller_path; "views" end @@ -96,7 +96,7 @@ class StreamingLayoutController < LayoutTest end class AbsolutePathLayoutController < LayoutTest - layout File.expand_path(File.expand_path(__FILE__) + "/../../../fixtures/actionpack/layout_tests/layouts/layout_test") + layout File.expand_path("../../fixtures/actionpack/layout_tests/layouts/layout_test", __dir__) end class HasOwnLayoutController < LayoutTest @@ -117,7 +117,7 @@ end class PrependsViewPathController < LayoutTest def hello - prepend_view_path File.dirname(__FILE__) + "/../../fixtures/actionpack/layout_tests/alt/" + prepend_view_path File.expand_path("../../fixtures/actionpack/layout_tests/alt", __dir__) render layout: "alt" end end diff --git a/actionview/test/actionpack/controller/render_test.rb b/actionview/test/actionpack/controller/render_test.rb index 51ec8899b1..6528169312 100644 --- a/actionview/test/actionpack/controller/render_test.rb +++ b/actionview/test/actionpack/controller/render_test.rb @@ -56,7 +56,7 @@ class TestController < ApplicationController end def hello_world_file - render file: File.expand_path("../../../fixtures/actionpack/hello", __FILE__), formats: [:html] + render file: File.expand_path("../../fixtures/actionpack/hello", __dir__), formats: [:html] end # :ported: @@ -125,7 +125,7 @@ class TestController < ApplicationController # :ported: def render_file_with_instance_variables @secret = "in the sauce" - path = File.join(File.dirname(__FILE__), "../../fixtures/test/render_file_with_ivar") + path = File.expand_path("../../fixtures/test/render_file_with_ivar", __dir__) render file: path end @@ -142,21 +142,21 @@ class TestController < ApplicationController def render_file_using_pathname @secret = "in the sauce" - render file: Pathname.new(File.dirname(__FILE__)).join("..", "..", "fixtures", "test", "dot.directory", "render_file_with_ivar") + render file: Pathname.new(__dir__).join("..", "..", "fixtures", "test", "dot.directory", "render_file_with_ivar") end def render_file_from_template @secret = "in the sauce" - @path = File.expand_path(File.join(File.dirname(__FILE__), "../../fixtures/test/render_file_with_ivar")) + @path = File.expand_path("../../fixtures/test/render_file_with_ivar", __dir__) end def render_file_with_locals - path = File.join(File.dirname(__FILE__), "../../fixtures/test/render_file_with_locals") + path = File.expand_path("../../fixtures/test/render_file_with_locals", __dir__) render file: path, locals: { secret: "in the sauce" } end def render_file_as_string_with_locals - path = File.expand_path(File.join(File.dirname(__FILE__), "../../fixtures/test/render_file_with_locals")) + path = File.expand_path("../../fixtures/test/render_file_with_locals", __dir__) render file: path, locals: { secret: "in the sauce" } end diff --git a/actionview/test/active_record_unit.rb b/actionview/test/active_record_unit.rb index 7f94b7ebb4..901c0e2b3e 100644 --- a/actionview/test/active_record_unit.rb +++ b/actionview/test/active_record_unit.rb @@ -13,7 +13,7 @@ end # Try to grab AR unless defined?(ActiveRecord) && defined?(FixtureSet) begin - PATH_TO_AR = "#{File.dirname(__FILE__)}/../../activerecord/lib" + PATH_TO_AR = File.expand_path("../../activerecord/lib", __dir__) raise LoadError, "#{PATH_TO_AR} doesn't exist" unless File.directory?(PATH_TO_AR) $LOAD_PATH.unshift PATH_TO_AR require "active_record" @@ -58,13 +58,13 @@ class ActiveRecordTestConnector # Load actionpack sqlite3 tables def load_schema - File.read(File.dirname(__FILE__) + "/fixtures/db_definitions/sqlite.sql").split(";").each do |sql| + File.read(File.expand_path("fixtures/db_definitions/sqlite.sql", __dir__)).split(";").each do |sql| ActiveRecord::Base.connection.execute(sql) unless sql.blank? end end def require_fixture_models - Dir.glob(File.dirname(__FILE__) + "/fixtures/*.rb").each { |f| require f } + Dir.glob(File.expand_path("fixtures/*.rb", __dir__)).each { |f| require f } end end end diff --git a/actionview/test/template/digestor_test.rb b/actionview/test/template/digestor_test.rb index e225c3de09..de04f3f25d 100644 --- a/actionview/test/template/digestor_test.rb +++ b/actionview/test/template/digestor_test.rb @@ -14,7 +14,7 @@ class FixtureTemplate end class FixtureFinder < ActionView::LookupContext - FIXTURES_DIR = "#{File.dirname(__FILE__)}/../fixtures/digestor" + FIXTURES_DIR = File.expand_path("../fixtures/digestor", __dir__) def initialize(details = {}) super(ActionView::PathSet.new(["digestor", "digestor/api"]), details, []) diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index fef78807d1..9999607067 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -138,7 +138,7 @@ module RenderTestCases end def test_render_file_with_full_path - template_path = File.join(File.dirname(__FILE__), "../fixtures/test/hello_world") + template_path = File.expand_path("../fixtures/test/hello_world", __dir__) assert_equal "Hello world!", @view.render(file: template_path) end @@ -160,7 +160,7 @@ module RenderTestCases end def test_render_outside_path - assert File.exist?(File.join(File.dirname(__FILE__), "../../test/abstract_unit.rb")) + assert File.exist?(File.expand_path("../../test/abstract_unit.rb", __dir__)) assert_raises ActionView::MissingTemplate do @view.render(template: "../\\../test/abstract_unit.rb") end diff --git a/actionview/test/template/resolver_patterns_test.rb b/actionview/test/template/resolver_patterns_test.rb index 43e3f21076..8e21f4b828 100644 --- a/actionview/test/template/resolver_patterns_test.rb +++ b/actionview/test/template/resolver_patterns_test.rb @@ -2,7 +2,7 @@ require "abstract_unit" class ResolverPatternsTest < ActiveSupport::TestCase def setup - path = File.expand_path("../../fixtures/", __FILE__) + path = File.expand_path("../fixtures", __dir__) pattern = ":prefix/{:formats/,}:action{.:formats,}{+:variants,}{.:handlers,}" @resolver = ActionView::FileSystemResolver.new(path, pattern) end diff --git a/actionview/test/ujs/config.ru b/actionview/test/ujs/config.ru index 48b7a4b53a..213a41127a 100644 --- a/actionview/test/ujs/config.ru +++ b/actionview/test/ujs/config.ru @@ -1,4 +1,4 @@ -$LOAD_PATH.unshift File.expand_path("..", __FILE__) +$LOAD_PATH.unshift __dir__ require "server" run UJS::Server -- cgit v1.2.3 From b8d0a08832a8c03e953f797d94e0766d61b3837e Mon Sep 17 00:00:00 2001 From: Adrian Stainforth Date: Fri, 19 May 2017 21:42:38 +0100 Subject: Update to rails-ujs documentation for yarn install --- actionview/app/assets/javascripts/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'actionview') diff --git a/actionview/app/assets/javascripts/README.md b/actionview/app/assets/javascripts/README.md index 399ebc7324..0819d5da5f 100644 --- a/actionview/app/assets/javascripts/README.md +++ b/actionview/app/assets/javascripts/README.md @@ -36,6 +36,16 @@ Require `rails-ujs` into your application.js manifest. //= require rails-ujs ``` +Usage with yarn +------------ + +When using with Webpacker gem or your preferred JavaScript bundler. Just add the following to your main JS file and compile. + +```javascript +import Rails from 'rails-ujs'; +Rails.start() +``` + How to run tests ------------ -- cgit v1.2.3 From 1c275d812f35f53f93cd96184a4f319983766cc5 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 29 May 2017 18:01:50 +0200 Subject: Add option for class_attribute default (#29270) * Allow a default value to be declared for class_attribute * Convert to using class_attribute default rather than explicit setter * Removed instance_accessor option by mistake * False is a valid default value * Documentation --- actionview/lib/action_view/helpers/form_helper.rb | 17 +++++++++-------- actionview/lib/action_view/layouts.rb | 6 +++--- actionview/lib/action_view/template/handlers/builder.rb | 5 +---- actionview/lib/action_view/template/handlers/erb.rb | 9 +++------ actionview/lib/action_view/view_paths.rb | 4 +--- 5 files changed, 17 insertions(+), 24 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index 3eafe0028e..672269b811 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -1606,14 +1606,15 @@ module ActionView include ModelNaming # The methods which wrap a form helper call. - class_attribute :field_helpers - self.field_helpers = [:fields_for, :fields, :label, :text_field, :password_field, - :hidden_field, :file_field, :text_area, :check_box, - :radio_button, :color_field, :search_field, - :telephone_field, :phone_field, :date_field, - :time_field, :datetime_field, :datetime_local_field, - :month_field, :week_field, :url_field, :email_field, - :number_field, :range_field] + class_attribute :field_helpers, default: [ + :fields_for, :fields, :label, :text_field, :password_field, + :hidden_field, :file_field, :text_area, :check_box, + :radio_button, :color_field, :search_field, + :telephone_field, :phone_field, :date_field, + :time_field, :datetime_field, :datetime_local_field, + :month_field, :week_field, :url_field, :email_field, + :number_field, :range_field + ] attr_accessor :object_name, :object, :options diff --git a/actionview/lib/action_view/layouts.rb b/actionview/lib/action_view/layouts.rb index 81feb90486..ab8409e8d0 100644 --- a/actionview/lib/action_view/layouts.rb +++ b/actionview/lib/action_view/layouts.rb @@ -204,9 +204,9 @@ module ActionView include ActionView::Rendering included do - class_attribute :_layout, :_layout_conditions, instance_accessor: false - self._layout = nil - self._layout_conditions = {} + class_attribute :_layout, instance_accessor: false + class_attribute :_layout_conditions, instance_accessor: false, default: {} + _write_layout_method end diff --git a/actionview/lib/action_view/template/handlers/builder.rb b/actionview/lib/action_view/template/handlers/builder.rb index e99b921cb7..67ad78133d 100644 --- a/actionview/lib/action_view/template/handlers/builder.rb +++ b/actionview/lib/action_view/template/handlers/builder.rb @@ -1,9 +1,7 @@ module ActionView module Template::Handlers class Builder - # Default format used by Builder. - class_attribute :default_format - self.default_format = :xml + class_attribute :default_format, default: :xml def call(template) require_engine @@ -14,7 +12,6 @@ module ActionView end private - def require_engine # :doc: @required ||= begin require "builder" diff --git a/actionview/lib/action_view/template/handlers/erb.rb b/actionview/lib/action_view/template/handlers/erb.rb index 58c7fd1a88..48c2e22a89 100644 --- a/actionview/lib/action_view/template/handlers/erb.rb +++ b/actionview/lib/action_view/template/handlers/erb.rb @@ -9,16 +9,13 @@ module ActionView # Specify trim mode for the ERB compiler. Defaults to '-'. # See ERB documentation for suitable values. - class_attribute :erb_trim_mode - self.erb_trim_mode = "-" + class_attribute :erb_trim_mode, default: "-" # Default implementation used. - class_attribute :erb_implementation - self.erb_implementation = Erubi + class_attribute :erb_implementation, default: Erubi # Do not escape templates of these mime types. - class_attribute :escape_whitelist - self.escape_whitelist = ["text/plain"] + class_attribute :escape_whitelist, default: ["text/plain"] ENCODING_TAG = Regexp.new("\\A(<%#{ENCODING_FLAG}-?%>)[ \\t]*") diff --git a/actionview/lib/action_view/view_paths.rb b/actionview/lib/action_view/view_paths.rb index f0fe6831fa..938f0fc17f 100644 --- a/actionview/lib/action_view/view_paths.rb +++ b/actionview/lib/action_view/view_paths.rb @@ -3,9 +3,7 @@ module ActionView extend ActiveSupport::Concern included do - class_attribute :_view_paths - self._view_paths = ActionView::PathSet.new - _view_paths.freeze + class_attribute :_view_paths, default: ActionView::PathSet.new.freeze end delegate :template_exists?, :any_templates?, :view_paths, :formats, :formats=, -- cgit v1.2.3 From 37fd3d6afb8f7fa184df92e6ce89fa032480605a Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Tue, 23 May 2017 09:08:59 +0300 Subject: Pass params __FILE__ and __LINE__ + 1 if class_eval with << --- actionview/lib/action_view/test_case.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/test_case.rb b/actionview/lib/action_view/test_case.rb index ae4fec4337..80403799ab 100644 --- a/actionview/lib/action_view/test_case.rb +++ b/actionview/lib/action_view/test_case.rb @@ -71,7 +71,7 @@ module ActionView def helper_method(*methods) # Almost a duplicate from ActionController::Helpers methods.flatten.each do |method| - _helpers.module_eval <<-end_eval + _helpers.module_eval <<-end_eval, __FILE__, __LINE__ + 1 def #{method}(*args, &block) # def current_user(*args, &block) _test_case.send(%(#{method}), *args, &block) # _test_case.send(%(current_user), *args, &block) end # end -- cgit v1.2.3 From 48f2a0c566526c291e6e1dd285dd9422802c6d0b Mon Sep 17 00:00:00 2001 From: Jon Moss Date: Mon, 29 May 2017 19:33:44 -0400 Subject: Grammar fixes [ci skip] --- actionview/app/assets/javascripts/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'actionview') diff --git a/actionview/app/assets/javascripts/README.md b/actionview/app/assets/javascripts/README.md index 0819d5da5f..f321b9f720 100644 --- a/actionview/app/assets/javascripts/README.md +++ b/actionview/app/assets/javascripts/README.md @@ -30,7 +30,7 @@ Run `yarn add rails-ujs` to install the rails-ujs package. Usage ------------ -Require `rails-ujs` into your application.js manifest. +Require `rails-ujs` in your application.js manifest. ```javascript //= require rails-ujs @@ -39,7 +39,8 @@ Require `rails-ujs` into your application.js manifest. Usage with yarn ------------ -When using with Webpacker gem or your preferred JavaScript bundler. Just add the following to your main JS file and compile. +When using with the Webpacker gem or your preferred JavaScript bundler, just +add the following to your main JS file and compile. ```javascript import Rails from 'rails-ujs'; -- cgit v1.2.3 From ba84867549a2bb5c1d3cb0bec8cf9f41e46f6d74 Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Mon, 22 May 2017 21:56:43 +0200 Subject: Remove requirement on mathn The test using mathn was first introduced in f1d9179 to check that the `distance_of_time_in_words` properly doesn't use the `Fixnum#/` method by explicitly requiring this library as it redefines this method. Given that `mathn` has been gemified in Ruby 2.5 and is deprecated since version 2.2, we can certainly safely assume that people will most-likely not require this library in their application. However, to make sure that we don't regress, let's add a test similar to the one before f1d9179. --- actionview/test/template/date_helper_test.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'actionview') diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb index a259752d6a..b667303318 100644 --- a/actionview/test/template/date_helper_test.rb +++ b/actionview/test/template/date_helper_test.rb @@ -138,11 +138,19 @@ class DateHelperTest < ActionView::TestCase assert_equal "10 minutes", distance_of_time_in_words(Time.at(600), 0) end - def test_distance_in_words_with_mathn_required - # test we avoid Integer#/ (redefined by mathn) - silence_warnings { require "mathn" } + def test_distance_in_words_doesnt_use_the_quotient_operator + rubinius_skip "Date is written in Ruby and relies on Fixnum#/" + jruby_skip "Date is written in Ruby and relies on Fixnum#/" + + klass = RUBY_VERSION > "2.4" ? Integer : Fixnum + + # Make sure that we avoid {Integer,Fixnum}#/ (redefined by mathn) + klass.send :private, :/ + from = Time.utc(2004, 6, 6, 21, 45, 0) assert_distance_of_time_in_words(from) + ensure + klass.send :public, :/ end def test_time_ago_in_words_passes_include_seconds -- cgit v1.2.3 From b6b0c99ff3e8ace3f42813154dbe4b8ad6a98e6c Mon Sep 17 00:00:00 2001 From: Genadi Samokovarov Date: Wed, 31 May 2017 12:16:20 +0300 Subject: Use mattr_accessor default: option throughout the project --- actionview/lib/action_view/base.rb | 15 +++++---------- actionview/lib/action_view/helpers/form_helper.rb | 6 ++---- actionview/lib/action_view/helpers/translation_helper.rb | 3 +-- actionview/lib/action_view/lookup_context.rb | 6 ++---- .../renderer/partial_renderer/collection_caching.rb | 2 +- actionview/lib/action_view/template/resolver.rb | 3 +-- actionview/test/template/url_helper_test.rb | 3 +-- 7 files changed, 13 insertions(+), 25 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/base.rb b/actionview/lib/action_view/base.rb index 5387174467..37f0dd1ee4 100644 --- a/actionview/lib/action_view/base.rb +++ b/actionview/lib/action_view/base.rb @@ -140,30 +140,25 @@ module ActionView #:nodoc: include Helpers, ::ERB::Util, Context # Specify the proc used to decorate input tags that refer to attributes with errors. - cattr_accessor :field_error_proc - @@field_error_proc = Proc.new { |html_tag, instance| "
#{html_tag}
".html_safe } + cattr_accessor :field_error_proc, default: Proc.new { |html_tag, instance| "
#{html_tag}
".html_safe } # How to complete the streaming when an exception occurs. # This is our best guess: first try to close the attribute, then the tag. - cattr_accessor :streaming_completion_on_exception - @@streaming_completion_on_exception = %(">) + cattr_accessor :streaming_completion_on_exception, default: %(">) # Specify whether rendering within namespaced controllers should prefix # the partial paths for ActiveModel objects with the namespace. # (e.g., an Admin::PostsController would render @post using /admin/posts/_post.erb) - cattr_accessor :prefix_partial_path_with_controller_namespace - @@prefix_partial_path_with_controller_namespace = true + cattr_accessor :prefix_partial_path_with_controller_namespace, default: true # Specify default_formats that can be rendered. cattr_accessor :default_formats # Specify whether an error should be raised for missing translations - cattr_accessor :raise_on_missing_translations - @@raise_on_missing_translations = false + cattr_accessor :raise_on_missing_translations, default: false # Specify whether submit_tag should automatically disable on click - cattr_accessor :automatically_disable_submit_tag - @@automatically_disable_submit_tag = true + cattr_accessor :automatically_disable_submit_tag, default: true class_attribute :_routes class_attribute :logger diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index 672269b811..4b2561e53d 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -474,7 +474,7 @@ module ActionView end private :apply_form_for_options! - mattr_accessor(:form_with_generates_remote_forms) { true } + mattr_accessor :form_with_generates_remote_forms, default: true # Creates a form tag based on mixing URLs, scopes, or models. # @@ -2318,8 +2318,6 @@ module ActionView end ActiveSupport.on_load(:action_view) do - cattr_accessor(:default_form_builder, instance_writer: false, instance_reader: false) do - ::ActionView::Helpers::FormBuilder - end + cattr_accessor :default_form_builder, instance_writer: false, instance_reader: false, default: ::ActionView::Helpers::FormBuilder end end diff --git a/actionview/lib/action_view/helpers/translation_helper.rb b/actionview/lib/action_view/helpers/translation_helper.rb index 47ed41a129..cc928f2b7a 100644 --- a/actionview/lib/action_view/helpers/translation_helper.rb +++ b/actionview/lib/action_view/helpers/translation_helper.rb @@ -11,8 +11,7 @@ module ActionView include TagHelper included do - mattr_accessor :debug_missing_translation - self.debug_missing_translation = true + mattr_accessor :debug_missing_translation, default: true end # Delegates to I18n#translate but also performs three additional diff --git a/actionview/lib/action_view/lookup_context.rb b/actionview/lib/action_view/lookup_context.rb index f385a7cd04..b7dbb38369 100644 --- a/actionview/lib/action_view/lookup_context.rb +++ b/actionview/lib/action_view/lookup_context.rb @@ -14,11 +14,9 @@ module ActionView class LookupContext #:nodoc: attr_accessor :prefixes, :rendered_format - mattr_accessor :fallbacks - @@fallbacks = FallbackFileSystemResolver.instances + mattr_accessor :fallbacks, default: FallbackFileSystemResolver.instances - mattr_accessor :registered_details - self.registered_details = [] + mattr_accessor :registered_details, default: [] def self.register_detail(name, &block) registered_details << name diff --git a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb index 847256ac78..32663fb80d 100644 --- a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb +++ b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb @@ -5,7 +5,7 @@ module ActionView included do # Fallback cache store if Action View is used without Rails. # Otherwise overridden in Railtie to use Rails.cache. - mattr_accessor(:collection_cache) { ActiveSupport::Cache::MemoryStore.new } + mattr_accessor :collection_cache, default: ActiveSupport::Cache::MemoryStore.new end private diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb index d3905b5f23..75ea4d31f5 100644 --- a/actionview/lib/action_view/template/resolver.rb +++ b/actionview/lib/action_view/template/resolver.rb @@ -125,8 +125,7 @@ module ActionView end end - cattr_accessor :caching - self.caching = true + cattr_accessor :caching, default: true class << self alias :caching? :caching diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb index 58d903b1c8..30dc719ce6 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -7,8 +7,7 @@ class UrlHelperTest < ActiveSupport::TestCase # In those cases, we'll set up a simple mock attr_accessor :controller, :request - cattr_accessor :request_forgery - self.request_forgery = false + cattr_accessor :request_forgery, default: false routes = ActionDispatch::Routing::RouteSet.new routes.draw do -- cgit v1.2.3 From e732f29d33f1e856c4a10af694863420c9b79e67 Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Thu, 27 Apr 2017 14:04:16 -0700 Subject: Move slicing to initializer. Forgot all about https://github.com/rails/rails/pull/28844/files#r113780934 cc @rafaelfranca --- actionview/lib/action_view/helpers/tags/base.rb | 2 +- actionview/lib/action_view/helpers/tags/select.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/helpers/tags/base.rb b/actionview/lib/action_view/helpers/tags/base.rb index aa420c4b66..0895533a60 100644 --- a/actionview/lib/action_view/helpers/tags/base.rb +++ b/actionview/lib/action_view/helpers/tags/base.rb @@ -149,7 +149,7 @@ module ActionView end value = options.fetch(:selected) { value(object) } - select = content_tag("select", add_options(option_tags, options, value), html_options.except!("skip_default_ids", "allow_method_names_outside_object")) + select = content_tag("select", add_options(option_tags, options, value), html_options) if html_options["multiple"] && options.fetch(:include_hidden, true) tag("input", disabled: html_options["disabled"], name: html_options["name"], type: "hidden", value: "") + select diff --git a/actionview/lib/action_view/helpers/tags/select.rb b/actionview/lib/action_view/helpers/tags/select.rb index 9ff7e54e4f..380f7a8c4e 100644 --- a/actionview/lib/action_view/helpers/tags/select.rb +++ b/actionview/lib/action_view/helpers/tags/select.rb @@ -6,7 +6,7 @@ module ActionView @choices = block_given? ? template_object.capture { yield || "" } : choices @choices = @choices.to_a if @choices.is_a?(Range) - @html_options = html_options + @html_options = html_options.except(:skip_default_ids, :allow_method_names_outside_object) super(object_name, method_name, template_object, options) end -- cgit v1.2.3 From 379a0b42daf0d8e14130db7fd886d05d8d88e3f2 Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Wed, 7 Jun 2017 21:18:04 +0200 Subject: Don't support namespace in form_with. form_with requires people to pass an id manually, so users can just prefix their namespace right there. --- actionview/test/template/form_helper/form_with_test.rb | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'actionview') diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb index bff0643fb0..df580f0369 100644 --- a/actionview/test/template/form_helper/form_with_test.rb +++ b/actionview/test/template/form_helper/form_with_test.rb @@ -878,24 +878,6 @@ class FormWithActsLikeFormForTest < FormWithTest assert_dom_equal expected, output_buffer end - def test_form_with_with_namespace - skip "Do namespaces still make sense?" - form_for(@post, namespace: "namespace") do |f| - concat f.text_field(:title) - concat f.text_area(:body) - concat f.check_box(:secret) - end - - expected = whole_form("/posts/123", "namespace_edit_post_123", "edit_post", method: "patch") do - "" \ - "" \ - "" \ - "" - end - - assert_dom_equal expected, output_buffer - end - def test_submit_with_object_as_new_record_and_locale_strings with_locale :submit do @post.persisted = false -- cgit v1.2.3 From 2abf6ca0c8304a3cfcdae6e14060b561780be43c Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Sun, 2 Apr 2017 00:24:03 +0800 Subject: Use a hash to record every partial's cache hit status instead of sharing a boolean. --- actionview/lib/action_view/base.rb | 1 + actionview/lib/action_view/helpers/cache_helper.rb | 6 ++-- .../lib/action_view/renderer/partial_renderer.rb | 2 +- .../test/activerecord/relation_cache_test.rb | 1 + .../test/_cached_nested_cached_customer.erb | 3 ++ .../test/fixtures/test/_nested_cached_customer.erb | 1 + actionview/test/template/log_subscriber_test.rb | 40 ++++++++++++++++++++++ 7 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 actionview/test/fixtures/test/_cached_nested_cached_customer.erb create mode 100644 actionview/test/fixtures/test/_nested_cached_customer.erb (limited to 'actionview') diff --git a/actionview/lib/action_view/base.rb b/actionview/lib/action_view/base.rb index 37f0dd1ee4..1808553239 100644 --- a/actionview/lib/action_view/base.rb +++ b/actionview/lib/action_view/base.rb @@ -202,6 +202,7 @@ module ActionView #:nodoc: @view_renderer = ActionView::Renderer.new(lookup_context) end + @cache_hit = {} assign(assigns) assign_controller(controller) _prepare_context diff --git a/actionview/lib/action_view/helpers/cache_helper.rb b/actionview/lib/action_view/helpers/cache_helper.rb index c3aecadcd6..dfa0956fe2 100644 --- a/actionview/lib/action_view/helpers/cache_helper.rb +++ b/actionview/lib/action_view/helpers/cache_helper.rb @@ -235,11 +235,13 @@ module ActionView end def fragment_for(name = {}, options = nil, &block) + # Some tests might using this helper without initialize actionview object + @cache_hit ||= {} if content = read_fragment_for(name, options) - @cache_hit = true + @cache_hit[@virtual_path] = true content else - @cache_hit = false + @cache_hit[@virtual_path] = false write_fragment_for(name, options, &block) end end diff --git a/actionview/lib/action_view/renderer/partial_renderer.rb b/actionview/lib/action_view/renderer/partial_renderer.rb index 647b15ea94..797db34fb8 100644 --- a/actionview/lib/action_view/renderer/partial_renderer.rb +++ b/actionview/lib/action_view/renderer/partial_renderer.rb @@ -344,7 +344,7 @@ module ActionView end content = layout.render(view, locals) { content } if layout - payload[:cache_hit] = view.cache_hit + payload[:cache_hit] = !!view.cache_hit[@template.virtual_path] content end end diff --git a/actionview/test/activerecord/relation_cache_test.rb b/actionview/test/activerecord/relation_cache_test.rb index fbab512c41..81903f3014 100644 --- a/actionview/test/activerecord/relation_cache_test.rb +++ b/actionview/test/activerecord/relation_cache_test.rb @@ -4,6 +4,7 @@ class RelationCacheTest < ActionView::TestCase tests ActionView::Helpers::CacheHelper def setup + @cache_hit = {} @virtual_path = "path" controller.cache_store = ActiveSupport::Cache::MemoryStore.new end diff --git a/actionview/test/fixtures/test/_cached_nested_cached_customer.erb b/actionview/test/fixtures/test/_cached_nested_cached_customer.erb new file mode 100644 index 0000000000..01bf025cd3 --- /dev/null +++ b/actionview/test/fixtures/test/_cached_nested_cached_customer.erb @@ -0,0 +1,3 @@ +<% cache cached_customer do %> + <%= render partial: "test/cached_customer", locals: { cached_customer: cached_customer } %> +<% end %> diff --git a/actionview/test/fixtures/test/_nested_cached_customer.erb b/actionview/test/fixtures/test/_nested_cached_customer.erb new file mode 100644 index 0000000000..f43adc94c9 --- /dev/null +++ b/actionview/test/fixtures/test/_nested_cached_customer.erb @@ -0,0 +1 @@ +<%= render partial: "test/cached_customer", locals: { cached_customer: cached_customer } %> diff --git a/actionview/test/template/log_subscriber_test.rb b/actionview/test/template/log_subscriber_test.rb index 584666d54b..94d2c35635 100644 --- a/actionview/test/template/log_subscriber_test.rb +++ b/actionview/test/template/log_subscriber_test.rb @@ -113,6 +113,46 @@ class AVLogSubscriberTest < ActiveSupport::TestCase end end + def test_render_nested_partial_while_outter_partial_not_cached + Rails.stub(:root, File.expand_path(FIXTURE_LOAD_PATH)) do + set_view_cache_dependencies + set_cache_controller + + @view.render(partial: "test/nested_cached_customer", locals: { cached_customer: Customer.new("Stan") }) + wait + assert_match(/Rendered test\/_nested_cached_customer\.erb (.*) \[cache miss\]/, @logger.logged(:info).last) + assert_match(/Rendered test\/_cached_customer\.erb (.*) \[cache miss\]/, @logger.logged(:info)[-2]) + + @view.render(partial: "test/nested_cached_customer", locals: { cached_customer: Customer.new("Stan") }) + wait + # Outter partial's log should not be affected by inner partial's result. + assert_match(/Rendered test\/_nested_cached_customer\.erb (.*) \[cache miss\]/, @logger.logged(:info).last) + assert_match(/Rendered test\/_cached_customer\.erb (.*) \[cache hit\]/, @logger.logged(:info)[-2]) + end + end + + def test_render_nested_partial_while_outter_partial_cached + Rails.stub(:root, File.expand_path(FIXTURE_LOAD_PATH)) do + set_view_cache_dependencies + set_cache_controller + + @view.render(partial: "test/cached_nested_cached_customer", locals: { cached_customer: Customer.new("Stan") }) + wait + assert_match(/Rendered test\/_cached_nested_cached_customer\.erb (.*) \[cache miss\]/, @logger.logged(:info).last) + assert_match(/Rendered test\/_cached_customer\.erb (.*) \[cache miss\]/, @logger.logged(:info)[-2]) + + @view.render(partial: "test/cached_nested_cached_customer", locals: { cached_customer: Customer.new("Stan") }) + wait + assert_match(/Rendered test\/_cached_nested_cached_customer\.erb (.*) \[cache hit\]/, @logger.logged(:info).last) + # Should not generate log about cached_customer partial + assert_equal 3, @logger.logged(:info).size + + @view.render(partial: "test/cached_customer", locals: { cached_customer: Customer.new("Stan") }) + wait + assert_match(/Rendered test\/_cached_customer\.erb (.*) \[cache hit\]/, @logger.logged(:info).last) + end + end + def test_render_partial_with_cache_hitted_and_missed Rails.stub(:root, File.expand_path(FIXTURE_LOAD_PATH)) do set_view_cache_dependencies -- cgit v1.2.3 From 8240636beda7b2b487217be1d945eb0d36145c4d Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Wed, 7 Jun 2017 22:17:34 +0200 Subject: Merge pull request https://github.com/rails/rails/pull/28637 from st0012/fix-partial-cache-logging --- actionview/lib/action_view/helpers/cache_helper.rb | 8 +--- actionview/lib/action_view/log_subscriber.rb | 7 ++-- .../lib/action_view/renderer/partial_renderer.rb | 2 +- actionview/lib/action_view/renderer/renderer.rb | 4 ++ .../test/activerecord/relation_cache_test.rb | 7 +++- actionview/test/template/log_subscriber_test.rb | 47 ++++++++++++---------- 6 files changed, 42 insertions(+), 33 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/helpers/cache_helper.rb b/actionview/lib/action_view/helpers/cache_helper.rb index dfa0956fe2..d515556e23 100644 --- a/actionview/lib/action_view/helpers/cache_helper.rb +++ b/actionview/lib/action_view/helpers/cache_helper.rb @@ -214,8 +214,6 @@ module ActionView end end - attr_reader :cache_hit # :nodoc: - private def fragment_name_with_digest(name, virtual_path) @@ -235,13 +233,11 @@ module ActionView end def fragment_for(name = {}, options = nil, &block) - # Some tests might using this helper without initialize actionview object - @cache_hit ||= {} if content = read_fragment_for(name, options) - @cache_hit[@virtual_path] = true + @view_renderer.cache_hits[@virtual_path] = :hit content else - @cache_hit[@virtual_path] = false + @view_renderer.cache_hits[@virtual_path] = :miss write_fragment_for(name, options, &block) end end diff --git a/actionview/lib/action_view/log_subscriber.rb b/actionview/lib/action_view/log_subscriber.rb index d03e1a51b8..ab8ec0aa42 100644 --- a/actionview/lib/action_view/log_subscriber.rb +++ b/actionview/lib/action_view/log_subscriber.rb @@ -25,7 +25,7 @@ module ActionView message = " Rendered #{from_rails_root(event.payload[:identifier])}" message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout] message << " (#{event.duration.round(1)}ms)" - message << " #{cache_message(event.payload)}" if event.payload.key?(:cache_hit) + message << " #{cache_message(event.payload)}" unless event.payload[:cache_hit].nil? message end end @@ -73,9 +73,10 @@ module ActionView end def cache_message(payload) # :doc: - if payload[:cache_hit] + case payload[:cache_hit] + when :hit "[cache hit]" - else + when :miss "[cache miss]" end end diff --git a/actionview/lib/action_view/renderer/partial_renderer.rb b/actionview/lib/action_view/renderer/partial_renderer.rb index 797db34fb8..1f8f997a2d 100644 --- a/actionview/lib/action_view/renderer/partial_renderer.rb +++ b/actionview/lib/action_view/renderer/partial_renderer.rb @@ -344,7 +344,7 @@ module ActionView end content = layout.render(view, locals) { content } if layout - payload[:cache_hit] = !!view.cache_hit[@template.virtual_path] + payload[:cache_hit] = view.view_renderer.cache_hits[@template.virtual_path] content end end diff --git a/actionview/lib/action_view/renderer/renderer.rb b/actionview/lib/action_view/renderer/renderer.rb index 2a3b89aebf..bcdeb85d30 100644 --- a/actionview/lib/action_view/renderer/renderer.rb +++ b/actionview/lib/action_view/renderer/renderer.rb @@ -46,5 +46,9 @@ module ActionView def render_partial(context, options, &block) #:nodoc: PartialRenderer.new(@lookup_context).render(context, options, block) end + + def cache_hits # :nodoc: + @cache_hits ||= {} + end end end diff --git a/actionview/test/activerecord/relation_cache_test.rb b/actionview/test/activerecord/relation_cache_test.rb index 81903f3014..d12c426586 100644 --- a/actionview/test/activerecord/relation_cache_test.rb +++ b/actionview/test/activerecord/relation_cache_test.rb @@ -4,8 +4,11 @@ class RelationCacheTest < ActionView::TestCase tests ActionView::Helpers::CacheHelper def setup - @cache_hit = {} - @virtual_path = "path" + view_paths = ActionController::Base.view_paths + lookup_context = ActionView::LookupContext.new(view_paths, {}, ["test"]) + @view_renderer = ActionView::Renderer.new(lookup_context) + @virtual_path = "path" + controller.cache_store = ActiveSupport::Cache::MemoryStore.new end diff --git a/actionview/test/template/log_subscriber_test.rb b/actionview/test/template/log_subscriber_test.rb index 94d2c35635..4c9f84f277 100644 --- a/actionview/test/template/log_subscriber_test.rb +++ b/actionview/test/template/log_subscriber_test.rb @@ -8,11 +8,14 @@ class AVLogSubscriberTest < ActiveSupport::TestCase def setup super - view_paths = ActionController::Base.view_paths + + view_paths = ActionController::Base.view_paths lookup_context = ActionView::LookupContext.new(view_paths, {}, ["test"]) - renderer = ActionView::Renderer.new(lookup_context) - @view = ActionView::Base.new(renderer, {}) + renderer = ActionView::Renderer.new(lookup_context) + @view = ActionView::Base.new(renderer, {}) + ActionView::LogSubscriber.attach_to :action_view + unless Rails.respond_to?(:root) @defined_root = true def Rails.root; :defined_root; end # Minitest `stub` expects the method to be defined. @@ -21,7 +24,9 @@ class AVLogSubscriberTest < ActiveSupport::TestCase def teardown super + ActiveSupport::LogSubscriber.log_subscribers.clear + # We need to undef `root`, RenderTestCases don't want this to be defined Rails.instance_eval { undef :root } if @defined_root end @@ -103,9 +108,9 @@ class AVLogSubscriberTest < ActiveSupport::TestCase set_view_cache_dependencies set_cache_controller - @view.render(partial: "test/cached_customer", locals: { cached_customer: Customer.new("david") }) # Second render should hit cache. @view.render(partial: "test/cached_customer", locals: { cached_customer: Customer.new("david") }) + @view.render(partial: "test/cached_customer", locals: { cached_customer: Customer.new("david") }) wait assert_equal 2, @logger.logged(:info).size @@ -113,43 +118,43 @@ class AVLogSubscriberTest < ActiveSupport::TestCase end end - def test_render_nested_partial_while_outter_partial_not_cached + def test_render_uncached_outer_partial_with_inner_cached_partial_wont_mix_cache_hits_or_misses Rails.stub(:root, File.expand_path(FIXTURE_LOAD_PATH)) do set_view_cache_dependencies set_cache_controller @view.render(partial: "test/nested_cached_customer", locals: { cached_customer: Customer.new("Stan") }) wait - assert_match(/Rendered test\/_nested_cached_customer\.erb (.*) \[cache miss\]/, @logger.logged(:info).last) - assert_match(/Rendered test\/_cached_customer\.erb (.*) \[cache miss\]/, @logger.logged(:info)[-2]) + *, cached_inner, uncached_outer = @logger.logged(:info) + assert_match(/Rendered test\/_cached_customer\.erb (.*) \[cache miss\]/, cached_inner) + assert_match(/Rendered test\/_nested_cached_customer\.erb \(.*?ms\)$/, uncached_outer) + # Second render hits the cache for the _cached_customer partial. Outer template's log shouldn't be affected. @view.render(partial: "test/nested_cached_customer", locals: { cached_customer: Customer.new("Stan") }) wait - # Outter partial's log should not be affected by inner partial's result. - assert_match(/Rendered test\/_nested_cached_customer\.erb (.*) \[cache miss\]/, @logger.logged(:info).last) - assert_match(/Rendered test\/_cached_customer\.erb (.*) \[cache hit\]/, @logger.logged(:info)[-2]) + *, cached_inner, uncached_outer = @logger.logged(:info) + assert_match(/Rendered test\/_cached_customer\.erb (.*) \[cache hit\]/, cached_inner) + assert_match(/Rendered test\/_nested_cached_customer\.erb \(.*?ms\)$/, uncached_outer) end end - def test_render_nested_partial_while_outter_partial_cached + def test_render_cached_outer_partial_with_cached_inner_partial Rails.stub(:root, File.expand_path(FIXTURE_LOAD_PATH)) do set_view_cache_dependencies set_cache_controller @view.render(partial: "test/cached_nested_cached_customer", locals: { cached_customer: Customer.new("Stan") }) wait - assert_match(/Rendered test\/_cached_nested_cached_customer\.erb (.*) \[cache miss\]/, @logger.logged(:info).last) - assert_match(/Rendered test\/_cached_customer\.erb (.*) \[cache miss\]/, @logger.logged(:info)[-2]) + *, cached_inner, cached_outer = @logger.logged(:info) + assert_match(/Rendered test\/_cached_customer\.erb (.*) \[cache miss\]/, cached_inner) + assert_match(/Rendered test\/_cached_nested_cached_customer\.erb (.*) \[cache miss\]/, cached_outer) - @view.render(partial: "test/cached_nested_cached_customer", locals: { cached_customer: Customer.new("Stan") }) - wait + # One render: inner partial skipped, because the outer has been cached. + assert_difference -> { @logger.logged(:info).size }, +1 do + @view.render(partial: "test/cached_nested_cached_customer", locals: { cached_customer: Customer.new("Stan") }) + wait + end assert_match(/Rendered test\/_cached_nested_cached_customer\.erb (.*) \[cache hit\]/, @logger.logged(:info).last) - # Should not generate log about cached_customer partial - assert_equal 3, @logger.logged(:info).size - - @view.render(partial: "test/cached_customer", locals: { cached_customer: Customer.new("Stan") }) - wait - assert_match(/Rendered test\/_cached_customer\.erb (.*) \[cache hit\]/, @logger.logged(:info).last) end end -- cgit v1.2.3 From 73715f29ab4c56ebcd74403903ebd691677ef318 Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Thu, 8 Jun 2017 21:56:24 +0200 Subject: Don't rely on the @view_renderer being defined. That won't be true for Action Pack and Action Mailer. --- actionview/lib/action_view/helpers/cache_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/helpers/cache_helper.rb b/actionview/lib/action_view/helpers/cache_helper.rb index d515556e23..b7c7324f31 100644 --- a/actionview/lib/action_view/helpers/cache_helper.rb +++ b/actionview/lib/action_view/helpers/cache_helper.rb @@ -234,10 +234,10 @@ module ActionView def fragment_for(name = {}, options = nil, &block) if content = read_fragment_for(name, options) - @view_renderer.cache_hits[@virtual_path] = :hit + @view_renderer.cache_hits[@virtual_path] = :hit if defined?(@view_renderer) content else - @view_renderer.cache_hits[@virtual_path] = :miss + @view_renderer.cache_hits[@virtual_path] = :miss if defined?(@view_renderer) write_fragment_for(name, options, &block) end end -- cgit v1.2.3 From bc9051422844c706b18fddc1449ea5e311c83490 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 11 Jun 2017 16:21:32 +0900 Subject: Generate field ids in `collection_check_boxes` and `collection_radio_buttons` This makes sure that the labels are linked up with the fields. Fixes #29014 --- actionview/CHANGELOG.md | 8 +++++ .../helpers/tags/collection_check_boxes.rb | 1 + .../helpers/tags/collection_radio_buttons.rb | 1 + .../test/template/form_helper/form_with_test.rb | 36 +++++++++++----------- 4 files changed, 28 insertions(+), 18 deletions(-) (limited to 'actionview') diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md index 122c42c5bd..ceaea40d18 100644 --- a/actionview/CHANGELOG.md +++ b/actionview/CHANGELOG.md @@ -1,3 +1,11 @@ +* Generate field ids in `collection_check_boxes` and `collection_radio_buttons`. + + This makes sure that the labels are linked up with the fields. + + Fixes #29014. + + *Yuji Yaginuma* + * Add `:json` type to `auto_discovery_link_tag` to support [JSON Feeds](https://jsonfeed.org/version/1) *Mike Gunderloy* diff --git a/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb b/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb index 7252d4f2d9..e02b7bdb2e 100644 --- a/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb +++ b/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb @@ -10,6 +10,7 @@ module ActionView def check_box(extra_html_options = {}) html_options = extra_html_options.merge(@input_html_options) html_options[:multiple] = true + html_options[:skip_default_ids] = false @template_object.check_box(@object_name, @method_name, html_options, @value, nil) end end diff --git a/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb b/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb index a5f72af9ff..f085a5fb73 100644 --- a/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb +++ b/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb @@ -9,6 +9,7 @@ module ActionView class RadioButtonBuilder < Builder # :nodoc: def radio_button(extra_html_options = {}) html_options = extra_html_options.merge(@input_html_options) + html_options[:skip_default_ids] = false @template_object.radio_button(@object_name, @method_name, @value, html_options) end end diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb index df580f0369..ecdd5ce672 100644 --- a/actionview/test/template/form_helper/form_with_test.rb +++ b/actionview/test/template/form_helper/form_with_test.rb @@ -403,9 +403,9 @@ class FormWithActsLikeFormForTest < FormWithTest expected = whole_form("/posts") do "" \ - "" \ + "" \ "" \ - "" \ + "" \ "" end @@ -426,10 +426,10 @@ class FormWithActsLikeFormForTest < FormWithTest expected = whole_form("/posts") do "" \ "" \ "" end @@ -452,10 +452,10 @@ class FormWithActsLikeFormForTest < FormWithTest expected = whole_form("/posts") do "" \ "" \ "" \ "" end @@ -473,9 +473,9 @@ class FormWithActsLikeFormForTest < FormWithTest expected = whole_form("/posts") do "" \ - "" \ + "" \ "" \ - "" \ + "" \ "" end @@ -492,11 +492,11 @@ class FormWithActsLikeFormForTest < FormWithTest expected = whole_form("/posts") do "" \ - "" \ + "" \ "" \ - "" \ + "" \ "" \ - "" \ + "" \ "" end @@ -517,13 +517,13 @@ class FormWithActsLikeFormForTest < FormWithTest expected = whole_form("/posts") do "" \ "" \ "" \ "" end @@ -547,13 +547,13 @@ class FormWithActsLikeFormForTest < FormWithTest expected = whole_form("/posts") do "" \ "" \ "" \ "" \ "" end @@ -572,7 +572,7 @@ class FormWithActsLikeFormForTest < FormWithTest expected = whole_form("/posts") do "" \ - "" \ + "" \ "" end -- cgit v1.2.3 From 6673cf7071094e87d473459452a2d0e4c2ccfebe Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Sun, 11 Jun 2017 15:59:23 +0300 Subject: Use `require_relative` instead of `require` with full path --- actionview/bin/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview') diff --git a/actionview/bin/test b/actionview/bin/test index a7beb14b27..470ce93f10 100755 --- a/actionview/bin/test +++ b/actionview/bin/test @@ -1,4 +1,4 @@ #!/usr/bin/env ruby COMPONENT_ROOT = File.expand_path("..", __dir__) -require File.expand_path("../tools/test", COMPONENT_ROOT) +require_relative "../../tools/test" -- cgit v1.2.3 From 0c66c25ba4a92edcdd41a3eba31a208bdff3b2b5 Mon Sep 17 00:00:00 2001 From: savroff Date: Mon, 19 Jun 2017 18:01:20 -0400 Subject: Fix current_page? helper issue with engine root path --- actionview/lib/action_view/helpers/url_helper.rb | 5 ++++- actionview/test/template/url_helper_test.rb | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb index a6857101b9..b78c367921 100644 --- a/actionview/lib/action_view/helpers/url_helper.rb +++ b/actionview/lib/action_view/helpers/url_helper.rb @@ -552,7 +552,10 @@ module ActionView request_uri = url_string.index("?") || check_parameters ? request.fullpath : request.path request_uri = URI.parser.unescape(request_uri).force_encoding(Encoding::BINARY) - url_string.chomp!("/") if url_string.start_with?("/") && url_string != "/" + if url_string.start_with?("/") && url_string != "/" + url_string.chomp!("/") + request_uri.chomp!("/") + end if %r{^\w+://}.match?(url_string) url_string == "#{request.protocol}#{request.host_with_port}#{request_uri}" diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb index 30dc719ce6..bdedbeba92 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -15,6 +15,10 @@ class UrlHelperTest < ActiveSupport::TestCase get "/other" => "foo#other" get "/article/:id" => "foo#article", :as => :article get "/category/:category" => "foo#category" + + scope :engine do + get "/" => "foo#bar" + end end include ActionView::Helpers::UrlHelper @@ -521,10 +525,10 @@ class UrlHelperTest < ActiveSupport::TestCase assert current_page?("http://www.example.com/?order=desc&page=1") end - def test_current_page_with_not_get_verb - @request = request_for_url("/events", method: :post) + def test_current_page_with_scope_that_match + @request = request_for_url("/engine/") - assert !current_page?("/events") + assert current_page?("/engine") end def test_current_page_with_escaped_params @@ -553,6 +557,12 @@ class UrlHelperTest < ActiveSupport::TestCase assert current_page?("/posts/") end + def test_current_page_with_not_get_verb + @request = request_for_url("/events", method: :post) + + assert !current_page?("/events") + end + def test_link_unless_current @request = request_for_url("/") -- cgit v1.2.3 From 01ddd1cecff3fabd1ecaeb86717612e757b74139 Mon Sep 17 00:00:00 2001 From: savroff Date: Mon, 19 Jun 2017 18:32:17 -0400 Subject: Add changes to CHANGELOG fix fix --- actionview/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'actionview') diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md index ceaea40d18..916d29a540 100644 --- a/actionview/CHANGELOG.md +++ b/actionview/CHANGELOG.md @@ -1,3 +1,9 @@ +* Fix issues with scopes and engine on `current_page?` method. + + Fixes #29401. + + *Nikita Savrov* + * Generate field ids in `collection_check_boxes` and `collection_radio_buttons`. This makes sure that the labels are linked up with the fields. -- cgit v1.2.3 From 4ff30d9bb6d5d591fbb3952112d721c995059302 Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Tue, 20 Jun 2017 18:35:44 +1000 Subject: Make ActiveModel frozen string literal friendly. Includes two external changes because they're referenced within the ActiveModel test suite. --- actionview/lib/action_view/helpers/javascript_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/helpers/javascript_helper.rb b/actionview/lib/action_view/helpers/javascript_helper.rb index 22e1e74ad6..6ba70ec081 100644 --- a/actionview/lib/action_view/helpers/javascript_helper.rb +++ b/actionview/lib/action_view/helpers/javascript_helper.rb @@ -13,8 +13,8 @@ module ActionView "'" => "\\'" } - JS_ESCAPE_MAP["\342\200\250".force_encoding(Encoding::UTF_8).encode!] = "
" - JS_ESCAPE_MAP["\342\200\251".force_encoding(Encoding::UTF_8).encode!] = "
" + JS_ESCAPE_MAP["\342\200\250".dup.force_encoding(Encoding::UTF_8).encode!] = "
" + JS_ESCAPE_MAP["\342\200\251".dup.force_encoding(Encoding::UTF_8).encode!] = "
" # Escapes carriage returns and single and double quotes for JavaScript segments. # -- cgit v1.2.3 From dd491b24ff28f637b1c8879002adb1acdf20a8ac Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Tue, 20 Jun 2017 19:45:46 +1000 Subject: Make ActionMailer frozen string literal friendly. --- actionview/lib/action_view/template.rb | 4 ++-- actionview/lib/action_view/template/resolver.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index b0e2f1e54e..3a69860630 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -282,7 +282,7 @@ module ActionView # Make sure that the resulting String to be eval'd is in the # encoding of the code - source = <<-end_src + source = <<-end_src.dup def #{method_name}(local_assigns, output_buffer) _old_virtual_path, @virtual_path = @virtual_path, #{@virtual_path.inspect};_old_output_buffer = @output_buffer;#{locals_code};#{code} ensure @@ -334,7 +334,7 @@ module ActionView def method_name @method_name ||= begin - m = "_#{identifier_method_name}__#{@identifier.hash}_#{__id__}" + m = "_#{identifier_method_name}__#{@identifier.hash}_#{__id__}".dup m.tr!("-".freeze, "_".freeze) m end diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb index 75ea4d31f5..65f8be26a0 100644 --- a/actionview/lib/action_view/template/resolver.rb +++ b/actionview/lib/action_view/template/resolver.rb @@ -14,7 +14,7 @@ module ActionView alias_method :partial?, :partial def self.build(name, prefix, partial) - virtual = "" + virtual = "".dup virtual << "#{prefix}/" unless prefix.empty? virtual << (partial ? "_#{name}" : name) new name, prefix, partial, virtual -- cgit v1.2.3 From 3d453b409d037a056d0bcd636a2e020cc7cef4a8 Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Tue, 20 Jun 2017 22:20:04 +1000 Subject: Make ActionView frozen string literal friendly. Plus a couple of related ActionPack patches. --- actionview/lib/action_view/helpers/date_helper.rb | 4 +- .../lib/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 +- actionview/lib/action_view/testing/resolvers.rb | 2 +- .../activerecord/form_helper_activerecord_test.rb | 4 +- actionview/test/fixtures/ruby_template.ruby | 2 +- actionview/test/template/atom_feed_helper_test.rb | 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 | 4 +- actionview/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 +- 19 files changed, 220 insertions(+), 220 deletions(-) (limited to 'actionview') 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 @@ module ActionView 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 @@ module ActionView # 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 @@ module ActionView 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 @@ module ActionView 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 @@ module ActionView 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 @@ module ActionView 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 @@ module ActionView # 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 @@ module ActionView #:nodoc: 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 @@ class FormHelperActiveRecordTest < ActionView::TestCase private def hidden_fields(method = nil) - txt = %{} + txt = %{}.dup if method && !%w(get post).include?(method.to_s) txt << %{} @@ -65,7 +65,7 @@ class FormHelperActiveRecordTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ 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).dup 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).dup 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).dup 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).dup 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).dup 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).dup 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).dup 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).dup expected << %(\n\n\n) expected << "\n" @@ -468,7 +468,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_with_disabled - expected = %(\n).dup 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).dup expected << %(\n\n\n) expected << "\n" @@ -486,7 +486,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_with_type_discarding - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -497,7 +497,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_descending - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -514,7 +514,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_with_html_options - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -522,7 +522,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_year_with_default_prompt - expected = %(\n).dup 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).dup 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).dup 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).dup expected << %(\n\n\n) expected << "\n" @@ -554,14 +554,14 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase end def test_select_minute_with_blank_and_step - expected = %(\n).dup expected << %(\n\n\n\n\n) expected << "\n" @@ -689,7 +689,7 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase end def test_select_date - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -858,7 +858,7 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_disabled - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -899,7 +899,7 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_zero_value - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -987,7 +987,7 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_html_options - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1068,7 +1068,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_separator - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1088,7 +1088,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_separator_and_discard_day - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1104,7 +1104,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_separator_discard_month_and_day - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1115,7 +1115,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_hidden - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1124,7 +1124,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_css_classes_option - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1140,7 +1140,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_custom_with_css_classes - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1156,7 +1156,7 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_html_class_option - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1220,7 +1220,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1248,7 +1248,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_ampm - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1276,7 +1276,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_separators - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1304,7 +1304,7 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_html_options - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1360,7 +1360,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_all_separators - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1396,7 +1396,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_default_prompt - expected = %(\n).dup expected << %(\n\n\n\n) expected << "\n" @@ -1425,7 +1425,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_custom_prompt - expected = %(\n).dup expected << %(\n\n\n\n) expected << "\n" @@ -1454,7 +1454,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_generic_with_css_classes - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1482,7 +1482,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_custom_with_css_classes - expected = %(\n).dup expected << %(\n\n\n) expected << "\n" @@ -1510,7 +1510,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_custom_hours - expected = %(\n).dup expected << %(\n\n\n\n) expected << "\n" @@ -1539,7 +1539,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_datetime_with_hidden - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) expected << %(\n) @@ -1551,7 +1551,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1570,7 +1570,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_ampm - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1588,7 +1588,7 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_seconds_and_separator - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1654,7 +1654,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_html_options - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1677,7 +1677,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_default_prompt - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1701,7 +1701,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_custom_prompt - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1726,7 +1726,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_generic_with_css_classes - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1750,7 +1750,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_custom_with_css_classes - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) @@ -1774,7 +1774,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_hidden - expected = %(\n) + expected = %(\n).dup expected << %(\n) expected << %(\n) expected << %(\n) @@ -1788,7 +1788,7 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase concat f.date_select(:written_on) end - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -1969,7 +1969,7 @@ class DateHelperTest < ActionView::TestCase concat f.date_select(:written_on) end - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -1981,7 +1981,7 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase concat f.time_select(:written_on, {}, class: "selector") end - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} @@ -2481,7 +2481,7 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @post = Post.new - expected = %{\n}.dup expected << %{\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2741,7 +2741,7 @@ class DateHelperTest < ActionView::TestCase concat f.datetime_select(:updated_at, {}, class: "selector") end - expected = %{\n} + expected = %{\n}.dup expected << %{\n} expected << %{\n} expected << %{ — \n} @@ -2754,7 +2754,7 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase 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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class DateHelperTest < ActionView::TestCase @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 @@ class FormWithActsLikeFormTagTest < FormWithTest 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 @@ class FormWithActsLikeFormTagTest < FormWithTest method = method.to_s == "get" ? "get" : "post" - txt = %{} + txt = %{}.dup end if method && !%w(get post).include?(method.to_s) @@ -2207,7 +2207,7 @@ class FormWithActsLikeFormForTest < FormWithTest 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 @@ class FormHelperTest < ActionView::TestCase end def form_text(action = "/", id = nil, html_class = nil, remote = nil, multipart = nil, method = nil) - txt = %{} end @@ -30,7 +30,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).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 @@ module RenderTestCases end CustomHandler = lambda do |template| - "@output_buffer = ''\n" \ + "@output_buffer = ''.dup\n" \ "@output_buffer << 'source: #{template.source.inspect}'\n" end @@ -583,7 +583,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!", 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 @@ class FiberedTest < ActiveSupport::TestCase 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 @@ class TestERBTemplate < ActiveSupport::TestCase 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 @@ class TextHelperTest < ActionView::TestCase 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 @@ 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 ...".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 @@ class TextHelperTest < ActionView::TestCase 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 @@ 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".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 -- cgit v1.2.3 From 3e6ce1cd698878d3324a5eda32bd600bfcb909f8 Mon Sep 17 00:00:00 2001 From: Grey Baker Date: Tue, 27 Jun 2017 11:06:28 +0100 Subject: Add source code and changelog links to gemspecs --- actionview/actionview.gemspec | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'actionview') diff --git a/actionview/actionview.gemspec b/actionview/actionview.gemspec index 41221dd04e..48e79c53ca 100644 --- a/actionview/actionview.gemspec +++ b/actionview/actionview.gemspec @@ -19,6 +19,11 @@ Gem::Specification.new do |s| s.require_path = "lib" s.requirements << "none" + s.metadata = { + "source_code_uri" => "https://github.com/rails/rails/tree/v#{version}/actionview", + "changelog_uri" => "https://github.com/rails/rails/blob/v#{version}/actionview/CHANGELOG.md" + } + s.add_dependency "activesupport", version s.add_dependency "builder", "~> 3.1" -- cgit v1.2.3 From 9fdebb17ff5f88a7cd65779efdd583f01a8717a7 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 28 Jun 2017 22:21:03 +0900 Subject: :scissors: [ci skip] --- actionview/CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'actionview') diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md index 916d29a540..e618183129 100644 --- a/actionview/CHANGELOG.md +++ b/actionview/CHANGELOG.md @@ -1,9 +1,9 @@ -* Fix issues with scopes and engine on `current_page?` method. - +* Fix issues with scopes and engine on `current_page?` method. + Fixes #29401. - + *Nikita Savrov* - + * Generate field ids in `collection_check_boxes` and `collection_radio_buttons`. This makes sure that the labels are linked up with the fields. -- cgit v1.2.3 From 43efae22a7a59d5fe0be599bd074c5e7d881266a Mon Sep 17 00:00:00 2001 From: Roberto Miranda Date: Sat, 3 Jun 2017 11:30:01 -0500 Subject: Add `srcset` option to `image_tag` helper --- actionview/CHANGELOG.md | 4 ++++ actionview/lib/action_view/helpers/asset_tag_helper.rb | 16 +++++++++++++++- actionview/test/template/asset_tag_helper_test.rb | 5 ++++- 3 files changed, 23 insertions(+), 2 deletions(-) (limited to 'actionview') diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md index e618183129..334b888b9b 100644 --- a/actionview/CHANGELOG.md +++ b/actionview/CHANGELOG.md @@ -1,3 +1,7 @@ +* Add `srcset` option to `image_tag` helper + + *Roberto Miranda* + * Fix issues with scopes and engine on `current_page?` method. Fixes #29401. diff --git a/actionview/lib/action_view/helpers/asset_tag_helper.rb b/actionview/lib/action_view/helpers/asset_tag_helper.rb index c21fe782c6..3d2b7e48fe 100644 --- a/actionview/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionview/lib/action_view/helpers/asset_tag_helper.rb @@ -227,16 +227,30 @@ module ActionView # # => Icon # image_tag("/icons/icon.gif", data: { title: 'Rails Application' }) # # => + # image_tag("icon.png", srcset: "/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w, /assets/pic_1980.jpg 1980w", sizes: '100vw', class: 'my-image') + # + # image_tag("icon.png", srcset: { 'pic_640.jpg' => '640w', 'pic_1024.jpg' => '1024w', 'pic_1980.jpg' => '1980w' }, sizes: '100vw', class: 'my-image') + # + # image_tag("icon.png", srcset: [['pic_640.jpg', '640w'], ['pic_1024.jpg', '1024w'], ['pic_1980.jpg', '1980w']], sizes: '100vw', class: 'my-image') + # def image_tag(source, options = {}) options = options.symbolize_keys check_for_image_tag_errors(options) + skip_pipeline = options.delete(:skip_pipeline) - src = options[:src] = path_to_image(source, skip_pipeline: options.delete(:skip_pipeline)) + src = options[:src] = path_to_image(source, skip_pipeline: skip_pipeline) unless src.start_with?("cid:") || src.start_with?("data:") || src.blank? options[:alt] = options.fetch(:alt) { image_alt(src) } end + if options[:srcset] && !options[:srcset].is_a?(String) + options[:srcset] = options[:srcset].map do |src, size| + src_path = path_to_image(src, skip_pipeline: skip_pipeline) + "#{src_path} #{size}" + end.join(", ") + end + options[:width], options[:height] = extract_dimensions(options.delete(:size)) if options[:size] tag("img", options) end diff --git a/actionview/test/template/asset_tag_helper_test.rb b/actionview/test/template/asset_tag_helper_test.rb index 6093a4e660..d1190b1bd7 100644 --- a/actionview/test/template/asset_tag_helper_test.rb +++ b/actionview/test/template/asset_tag_helper_test.rb @@ -197,7 +197,10 @@ class AssetTagHelperTest < ActionView::TestCase %(image_tag("mouse.png", :alt => nil)) => %(), %(image_tag("data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==", :alt => nil)) => %(), %(image_tag("")) => %(), - %(image_tag("gold.png", data: { title: 'Rails Application' })) => %(Gold) + %(image_tag("gold.png", data: { title: 'Rails Application' })) => %(Gold), + %(image_tag("rss.gif", srcset: "/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w")) => %(Rss), + %(image_tag("rss.gif", srcset: { "pic_640.jpg" => "640w", "pic_1024.jpg" => "1024w" })) => %(Rss), + %(image_tag("rss.gif", srcset: [["pic_640.jpg", "640w"], ["pic_1024.jpg", "1024w"]])) => %(Rss) } FaviconLinkToTag = { -- cgit v1.2.3 From da895edf2e43d8c03089df7042a5bff7ef15fff0 Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Thu, 29 Jun 2017 20:25:54 +0300 Subject: Fallback Parameters#to_s to Hash#to_s Fixes https://github.com/rails/rails/issues/29617 --- actionview/test/template/form_tag_helper_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'actionview') diff --git a/actionview/test/template/form_tag_helper_test.rb b/actionview/test/template/form_tag_helper_test.rb index 084c540139..c13d0c32ae 100644 --- a/actionview/test/template/form_tag_helper_test.rb +++ b/actionview/test/template/form_tag_helper_test.rb @@ -345,6 +345,12 @@ class FormTagHelperTest < ActionView::TestCase assert_dom_equal expected, actual end + def test_text_field_tag_with_ac_parameters + actual = text_field_tag "title", ActionController::Parameters.new(key: "value") + expected = %() + assert_dom_equal expected, actual + end + def test_text_field_tag_size_string actual = text_field_tag "title", "Hello!", "size" => "75" expected = %() -- cgit v1.2.3 From cfade1ec7ee7b5b51f3c1578e3474f9c156f2971 Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Thu, 22 Jun 2017 22:59:18 -0400 Subject: Enforce frozen string in Rubocop --- actionview/Rakefile | 1 + actionview/actionview.gemspec | 1 + actionview/bin/test | 1 + actionview/lib/action_view.rb | 1 + actionview/lib/action_view/base.rb | 1 + actionview/lib/action_view/buffers.rb | 1 + actionview/lib/action_view/context.rb | 1 + actionview/lib/action_view/dependency_tracker.rb | 1 + actionview/lib/action_view/digestor.rb | 1 + actionview/lib/action_view/flows.rb | 1 + actionview/lib/action_view/gem_version.rb | 1 + actionview/lib/action_view/helpers.rb | 1 + actionview/lib/action_view/helpers/active_model_helper.rb | 1 + actionview/lib/action_view/helpers/asset_tag_helper.rb | 1 + actionview/lib/action_view/helpers/asset_url_helper.rb | 1 + actionview/lib/action_view/helpers/atom_feed_helper.rb | 1 + actionview/lib/action_view/helpers/cache_helper.rb | 1 + actionview/lib/action_view/helpers/capture_helper.rb | 1 + actionview/lib/action_view/helpers/controller_helper.rb | 1 + actionview/lib/action_view/helpers/csrf_helper.rb | 1 + actionview/lib/action_view/helpers/date_helper.rb | 1 + actionview/lib/action_view/helpers/debug_helper.rb | 1 + actionview/lib/action_view/helpers/form_helper.rb | 1 + actionview/lib/action_view/helpers/form_options_helper.rb | 1 + actionview/lib/action_view/helpers/form_tag_helper.rb | 1 + actionview/lib/action_view/helpers/javascript_helper.rb | 1 + actionview/lib/action_view/helpers/number_helper.rb | 1 + actionview/lib/action_view/helpers/output_safety_helper.rb | 1 + actionview/lib/action_view/helpers/record_tag_helper.rb | 1 + actionview/lib/action_view/helpers/rendering_helper.rb | 1 + actionview/lib/action_view/helpers/sanitize_helper.rb | 1 + actionview/lib/action_view/helpers/tag_helper.rb | 2 +- actionview/lib/action_view/helpers/tags.rb | 1 + actionview/lib/action_view/helpers/tags/base.rb | 1 + actionview/lib/action_view/helpers/tags/check_box.rb | 1 + actionview/lib/action_view/helpers/tags/checkable.rb | 1 + actionview/lib/action_view/helpers/tags/collection_check_boxes.rb | 1 + actionview/lib/action_view/helpers/tags/collection_helpers.rb | 1 + actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb | 1 + actionview/lib/action_view/helpers/tags/collection_select.rb | 1 + actionview/lib/action_view/helpers/tags/color_field.rb | 1 + actionview/lib/action_view/helpers/tags/date_field.rb | 1 + actionview/lib/action_view/helpers/tags/date_select.rb | 1 + actionview/lib/action_view/helpers/tags/datetime_field.rb | 1 + actionview/lib/action_view/helpers/tags/datetime_local_field.rb | 1 + actionview/lib/action_view/helpers/tags/datetime_select.rb | 1 + actionview/lib/action_view/helpers/tags/email_field.rb | 1 + actionview/lib/action_view/helpers/tags/file_field.rb | 1 + actionview/lib/action_view/helpers/tags/grouped_collection_select.rb | 1 + actionview/lib/action_view/helpers/tags/hidden_field.rb | 1 + actionview/lib/action_view/helpers/tags/label.rb | 1 + actionview/lib/action_view/helpers/tags/month_field.rb | 1 + actionview/lib/action_view/helpers/tags/number_field.rb | 1 + actionview/lib/action_view/helpers/tags/password_field.rb | 1 + actionview/lib/action_view/helpers/tags/placeholderable.rb | 1 + actionview/lib/action_view/helpers/tags/radio_button.rb | 1 + actionview/lib/action_view/helpers/tags/range_field.rb | 1 + actionview/lib/action_view/helpers/tags/search_field.rb | 1 + actionview/lib/action_view/helpers/tags/select.rb | 1 + actionview/lib/action_view/helpers/tags/tel_field.rb | 1 + actionview/lib/action_view/helpers/tags/text_area.rb | 1 + actionview/lib/action_view/helpers/tags/text_field.rb | 1 + actionview/lib/action_view/helpers/tags/time_field.rb | 1 + actionview/lib/action_view/helpers/tags/time_select.rb | 1 + actionview/lib/action_view/helpers/tags/time_zone_select.rb | 1 + actionview/lib/action_view/helpers/tags/translator.rb | 1 + actionview/lib/action_view/helpers/tags/url_field.rb | 1 + actionview/lib/action_view/helpers/tags/week_field.rb | 1 + actionview/lib/action_view/helpers/text_helper.rb | 1 + actionview/lib/action_view/helpers/translation_helper.rb | 1 + actionview/lib/action_view/helpers/url_helper.rb | 1 + actionview/lib/action_view/layouts.rb | 1 + actionview/lib/action_view/log_subscriber.rb | 1 + actionview/lib/action_view/lookup_context.rb | 1 + actionview/lib/action_view/model_naming.rb | 1 + actionview/lib/action_view/path_set.rb | 1 + actionview/lib/action_view/railtie.rb | 1 + actionview/lib/action_view/record_identifier.rb | 1 + actionview/lib/action_view/renderer/abstract_renderer.rb | 1 + actionview/lib/action_view/renderer/partial_renderer.rb | 1 + .../lib/action_view/renderer/partial_renderer/collection_caching.rb | 1 + actionview/lib/action_view/renderer/renderer.rb | 1 + actionview/lib/action_view/renderer/streaming_template_renderer.rb | 1 + actionview/lib/action_view/renderer/template_renderer.rb | 1 + actionview/lib/action_view/rendering.rb | 1 + actionview/lib/action_view/routing_url_for.rb | 1 + actionview/lib/action_view/tasks/cache_digests.rake | 1 + actionview/lib/action_view/template.rb | 1 + actionview/lib/action_view/template/error.rb | 1 + actionview/lib/action_view/template/handlers.rb | 1 + actionview/lib/action_view/template/handlers/builder.rb | 1 + actionview/lib/action_view/template/handlers/erb.rb | 1 + actionview/lib/action_view/template/handlers/erb/deprecated_erubis.rb | 1 + actionview/lib/action_view/template/handlers/erb/erubi.rb | 1 + actionview/lib/action_view/template/handlers/erb/erubis.rb | 1 + actionview/lib/action_view/template/handlers/html.rb | 1 + actionview/lib/action_view/template/handlers/raw.rb | 1 + actionview/lib/action_view/template/html.rb | 1 + actionview/lib/action_view/template/resolver.rb | 1 + actionview/lib/action_view/template/text.rb | 1 + actionview/lib/action_view/template/types.rb | 1 + actionview/lib/action_view/test_case.rb | 1 + actionview/lib/action_view/testing/resolvers.rb | 1 + actionview/lib/action_view/version.rb | 1 + actionview/lib/action_view/view_paths.rb | 1 + actionview/test/abstract_unit.rb | 1 + actionview/test/actionpack/abstract/abstract_controller_test.rb | 1 + actionview/test/actionpack/abstract/helper_test.rb | 1 + actionview/test/actionpack/abstract/layouts_test.rb | 1 + actionview/test/actionpack/abstract/render_test.rb | 1 + actionview/test/actionpack/controller/capture_test.rb | 1 + actionview/test/actionpack/controller/layout_test.rb | 1 + actionview/test/actionpack/controller/render_test.rb | 1 + actionview/test/actionpack/controller/view_paths_test.rb | 1 + actionview/test/active_record_unit.rb | 1 + actionview/test/activerecord/controller_runtime_test.rb | 1 + actionview/test/activerecord/debug_helper_test.rb | 1 + actionview/test/activerecord/form_helper_activerecord_test.rb | 1 + actionview/test/activerecord/polymorphic_routes_test.rb | 1 + actionview/test/activerecord/relation_cache_test.rb | 1 + .../test/activerecord/render_partial_with_record_identification_test.rb | 1 + actionview/test/fixtures/actionpack/layouts/builder.builder | 1 + actionview/test/fixtures/actionpack/test/_hello.builder | 1 + actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder | 1 + actionview/test/fixtures/actionpack/test/hello.builder | 1 + actionview/test/fixtures/actionpack/test/hello_world_container.builder | 1 + actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder | 1 + actionview/test/fixtures/actionpack/test/hello_xml_world.builder | 1 + .../test/fixtures/actionpack/test/implicit_content_type.atom.builder | 1 + .../test/fixtures/actionpack/test/non_erb_block_content_for.builder | 1 + actionview/test/fixtures/comments/empty.html.builder | 1 + actionview/test/fixtures/company.rb | 1 + actionview/test/fixtures/developer.rb | 1 + actionview/test/fixtures/helpers/abc_helper.rb | 1 + actionview/test/fixtures/helpers/helpery_test_helper.rb | 1 + actionview/test/fixtures/helpers_missing/invalid_require_helper.rb | 1 + actionview/test/fixtures/mascot.rb | 1 + actionview/test/fixtures/project.rb | 1 + actionview/test/fixtures/reply.rb | 1 + actionview/test/fixtures/ruby_template.ruby | 1 + actionview/test/fixtures/test/hello.builder | 1 + actionview/test/fixtures/topic.rb | 1 + actionview/test/lib/controller/fake_models.rb | 1 + actionview/test/template/active_model_helper_test.rb | 1 + actionview/test/template/asset_tag_helper_test.rb | 1 + actionview/test/template/atom_feed_helper_test.rb | 1 + actionview/test/template/capture_helper_test.rb | 1 + actionview/test/template/compiled_templates_test.rb | 1 + actionview/test/template/controller_helper_test.rb | 1 + actionview/test/template/date_helper_i18n_test.rb | 1 + actionview/test/template/date_helper_test.rb | 1 + actionview/test/template/dependency_tracker_test.rb | 1 + actionview/test/template/digestor_test.rb | 1 + actionview/test/template/erb/deprecated_erubis_implementation_test.rb | 1 + actionview/test/template/erb/form_for_test.rb | 1 + actionview/test/template/erb/helper.rb | 1 + actionview/test/template/erb/tag_helper_test.rb | 1 + actionview/test/template/erb_util_test.rb | 1 + actionview/test/template/form_collections_helper_test.rb | 1 + actionview/test/template/form_helper/form_with_test.rb | 1 + actionview/test/template/form_helper_test.rb | 1 + actionview/test/template/form_options_helper_i18n_test.rb | 1 + actionview/test/template/form_options_helper_test.rb | 1 + actionview/test/template/form_tag_helper_test.rb | 1 + actionview/test/template/html_test.rb | 1 + actionview/test/template/javascript_helper_test.rb | 1 + actionview/test/template/log_subscriber_test.rb | 1 + actionview/test/template/lookup_context_test.rb | 1 + actionview/test/template/number_helper_test.rb | 1 + actionview/test/template/output_safety_helper_test.rb | 1 + actionview/test/template/partial_iteration_test.rb | 1 + actionview/test/template/record_identifier_test.rb | 1 + actionview/test/template/record_tag_helper_test.rb | 1 + actionview/test/template/render_test.rb | 1 + actionview/test/template/resolver_cache_test.rb | 1 + actionview/test/template/resolver_patterns_test.rb | 1 + actionview/test/template/sanitize_helper_test.rb | 1 + actionview/test/template/streaming_render_test.rb | 1 + actionview/test/template/tag_helper_test.rb | 1 + actionview/test/template/template_error_test.rb | 1 + actionview/test/template/template_test.rb | 1 + actionview/test/template/test_case_test.rb | 1 + actionview/test/template/test_test.rb | 1 + actionview/test/template/testing/fixture_resolver_test.rb | 1 + actionview/test/template/testing/null_resolver_test.rb | 1 + actionview/test/template/text_helper_test.rb | 1 + actionview/test/template/text_test.rb | 1 + actionview/test/template/translation_helper_test.rb | 1 + actionview/test/template/url_helper_test.rb | 1 + actionview/test/ujs/config.ru | 1 + actionview/test/ujs/server.rb | 1 + 191 files changed, 191 insertions(+), 1 deletion(-) (limited to 'actionview') diff --git a/actionview/Rakefile b/actionview/Rakefile index 0fc38e8db4..564971ce14 100644 --- a/actionview/Rakefile +++ b/actionview/Rakefile @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rake/testtask" require "fileutils" require "open3" diff --git a/actionview/actionview.gemspec b/actionview/actionview.gemspec index 48e79c53ca..5455a37c5e 100644 --- a/actionview/actionview.gemspec +++ b/actionview/actionview.gemspec @@ -1,3 +1,4 @@ +# frozen_string_literal: true version = File.read(File.expand_path("../RAILS_VERSION", __dir__)).strip Gem::Specification.new do |s| diff --git a/actionview/bin/test b/actionview/bin/test index 470ce93f10..c53377cc97 100755 --- a/actionview/bin/test +++ b/actionview/bin/test @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true COMPONENT_ROOT = File.expand_path("..", __dir__) require_relative "../../tools/test" diff --git a/actionview/lib/action_view.rb b/actionview/lib/action_view.rb index 99c5b831b5..c125651a64 100644 --- a/actionview/lib/action_view.rb +++ b/actionview/lib/action_view.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true #-- # Copyright (c) 2004-2017 David Heinemeier Hansson # diff --git a/actionview/lib/action_view/base.rb b/actionview/lib/action_view/base.rb index 1808553239..51f8202de4 100644 --- a/actionview/lib/action_view/base.rb +++ b/actionview/lib/action_view/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/module/attr_internal" require "active_support/core_ext/module/attribute_accessors" require "active_support/ordered_options" diff --git a/actionview/lib/action_view/buffers.rb b/actionview/lib/action_view/buffers.rb index 089daa6d60..824995582b 100644 --- a/actionview/lib/action_view/buffers.rb +++ b/actionview/lib/action_view/buffers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/string/output_safety" module ActionView diff --git a/actionview/lib/action_view/context.rb b/actionview/lib/action_view/context.rb index 31aa73a0cf..3a24a7692e 100644 --- a/actionview/lib/action_view/context.rb +++ b/actionview/lib/action_view/context.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module CompiledTemplates #:nodoc: # holds compiled template code diff --git a/actionview/lib/action_view/dependency_tracker.rb b/actionview/lib/action_view/dependency_tracker.rb index 451eeec9d6..9128494501 100644 --- a/actionview/lib/action_view/dependency_tracker.rb +++ b/actionview/lib/action_view/dependency_tracker.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "concurrent/map" require "action_view/path_set" diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb index 5ddf1ceb66..9a5e11699c 100644 --- a/actionview/lib/action_view/digestor.rb +++ b/actionview/lib/action_view/digestor.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "concurrent/map" require "action_view/dependency_tracker" require "monitor" diff --git a/actionview/lib/action_view/flows.rb b/actionview/lib/action_view/flows.rb index 6d5f57a570..d933f05456 100644 --- a/actionview/lib/action_view/flows.rb +++ b/actionview/lib/action_view/flows.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/string/output_safety" module ActionView diff --git a/actionview/lib/action_view/gem_version.rb b/actionview/lib/action_view/gem_version.rb index 92e21d7a4f..44425b4aa3 100644 --- a/actionview/lib/action_view/gem_version.rb +++ b/actionview/lib/action_view/gem_version.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView # Returns the version of the currently loaded Action View as a Gem::Version def self.gem_version diff --git a/actionview/lib/action_view/helpers.rb b/actionview/lib/action_view/helpers.rb index c1b4b4f84b..b98041252c 100644 --- a/actionview/lib/action_view/helpers.rb +++ b/actionview/lib/action_view/helpers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/benchmarkable" module ActionView #:nodoc: diff --git a/actionview/lib/action_view/helpers/active_model_helper.rb b/actionview/lib/action_view/helpers/active_model_helper.rb index 4bb5788a16..ba3b5801c9 100644 --- a/actionview/lib/action_view/helpers/active_model_helper.rb +++ b/actionview/lib/action_view/helpers/active_model_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/module/attribute_accessors" require "active_support/core_ext/enumerable" diff --git a/actionview/lib/action_view/helpers/asset_tag_helper.rb b/actionview/lib/action_view/helpers/asset_tag_helper.rb index c21fe782c6..791454ca87 100644 --- a/actionview/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionview/lib/action_view/helpers/asset_tag_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/array/extract_options" require "active_support/core_ext/hash/keys" require "action_view/helpers/asset_url_helper" diff --git a/actionview/lib/action_view/helpers/asset_url_helper.rb b/actionview/lib/action_view/helpers/asset_url_helper.rb index 03bd1eb008..f9f12fdba5 100644 --- a/actionview/lib/action_view/helpers/asset_url_helper.rb +++ b/actionview/lib/action_view/helpers/asset_url_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "zlib" module ActionView diff --git a/actionview/lib/action_view/helpers/atom_feed_helper.rb b/actionview/lib/action_view/helpers/atom_feed_helper.rb index 3538515aee..a4ec1f9388 100644 --- a/actionview/lib/action_view/helpers/atom_feed_helper.rb +++ b/actionview/lib/action_view/helpers/atom_feed_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "set" module ActionView diff --git a/actionview/lib/action_view/helpers/cache_helper.rb b/actionview/lib/action_view/helpers/cache_helper.rb index b7c7324f31..101fe86e9f 100644 --- a/actionview/lib/action_view/helpers/cache_helper.rb +++ b/actionview/lib/action_view/helpers/cache_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView # = Action View Cache Helper module Helpers diff --git a/actionview/lib/action_view/helpers/capture_helper.rb b/actionview/lib/action_view/helpers/capture_helper.rb index 719592b5c5..0865ac0a7e 100644 --- a/actionview/lib/action_view/helpers/capture_helper.rb +++ b/actionview/lib/action_view/helpers/capture_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/string/output_safety" module ActionView diff --git a/actionview/lib/action_view/helpers/controller_helper.rb b/actionview/lib/action_view/helpers/controller_helper.rb index e86cdca4e4..0991fc16e0 100644 --- a/actionview/lib/action_view/helpers/controller_helper.rb +++ b/actionview/lib/action_view/helpers/controller_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/module/attr_internal" module ActionView diff --git a/actionview/lib/action_view/helpers/csrf_helper.rb b/actionview/lib/action_view/helpers/csrf_helper.rb index 2a15d2aa5a..f560445b83 100644 --- a/actionview/lib/action_view/helpers/csrf_helper.rb +++ b/actionview/lib/action_view/helpers/csrf_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView # = Action View CSRF Helper module Helpers diff --git a/actionview/lib/action_view/helpers/date_helper.rb b/actionview/lib/action_view/helpers/date_helper.rb index 3f43465aa4..2c30f88c3b 100644 --- a/actionview/lib/action_view/helpers/date_helper.rb +++ b/actionview/lib/action_view/helpers/date_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "date" require "action_view/helpers/tag_helper" require "active_support/core_ext/array/extract_options" diff --git a/actionview/lib/action_view/helpers/debug_helper.rb b/actionview/lib/action_view/helpers/debug_helper.rb index f61ca2c9c2..26c97ab2bf 100644 --- a/actionview/lib/action_view/helpers/debug_helper.rb +++ b/actionview/lib/action_view/helpers/debug_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView # = Action View Debug Helper # diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index 4b2561e53d..4a1e6ae9bd 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cgi" require "action_view/helpers/date_helper" require "action_view/helpers/tag_helper" diff --git a/actionview/lib/action_view/helpers/form_options_helper.rb b/actionview/lib/action_view/helpers/form_options_helper.rb index 07d4310a4e..7d0fbce34e 100644 --- a/actionview/lib/action_view/helpers/form_options_helper.rb +++ b/actionview/lib/action_view/helpers/form_options_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cgi" require "erb" require "action_view/helpers/form_helper" diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 9fc08b3837..8225fa1e38 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "cgi" require "action_view/helpers/tag_helper" require "active_support/core_ext/string/output_safety" diff --git a/actionview/lib/action_view/helpers/javascript_helper.rb b/actionview/lib/action_view/helpers/javascript_helper.rb index 22e1e74ad6..2c93647534 100644 --- a/actionview/lib/action_view/helpers/javascript_helper.rb +++ b/actionview/lib/action_view/helpers/javascript_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_view/helpers/tag_helper" module ActionView diff --git a/actionview/lib/action_view/helpers/number_helper.rb b/actionview/lib/action_view/helpers/number_helper.rb index b6bc5f4f6f..e40041cb74 100644 --- a/actionview/lib/action_view/helpers/number_helper.rb +++ b/actionview/lib/action_view/helpers/number_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/hash/keys" require "active_support/core_ext/string/output_safety" require "active_support/number_helper" diff --git a/actionview/lib/action_view/helpers/output_safety_helper.rb b/actionview/lib/action_view/helpers/output_safety_helper.rb index 25defd1276..71e5862698 100644 --- a/actionview/lib/action_view/helpers/output_safety_helper.rb +++ b/actionview/lib/action_view/helpers/output_safety_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/string/output_safety" module ActionView #:nodoc: diff --git a/actionview/lib/action_view/helpers/record_tag_helper.rb b/actionview/lib/action_view/helpers/record_tag_helper.rb index f7ee573035..7aca005d46 100644 --- a/actionview/lib/action_view/helpers/record_tag_helper.rb +++ b/actionview/lib/action_view/helpers/record_tag_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module RecordTagHelper diff --git a/actionview/lib/action_view/helpers/rendering_helper.rb b/actionview/lib/action_view/helpers/rendering_helper.rb index 7d7f2393ff..ffb5627805 100644 --- a/actionview/lib/action_view/helpers/rendering_helper.rb +++ b/actionview/lib/action_view/helpers/rendering_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers # = Action View Rendering diff --git a/actionview/lib/action_view/helpers/sanitize_helper.rb b/actionview/lib/action_view/helpers/sanitize_helper.rb index 0abd5bc5dc..b7757086c3 100644 --- a/actionview/lib/action_view/helpers/sanitize_helper.rb +++ b/actionview/lib/action_view/helpers/sanitize_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/object/try" require "rails-html-sanitizer" diff --git a/actionview/lib/action_view/helpers/tag_helper.rb b/actionview/lib/action_view/helpers/tag_helper.rb index 306b71c85e..a64d7e396e 100644 --- a/actionview/lib/action_view/helpers/tag_helper.rb +++ b/actionview/lib/action_view/helpers/tag_helper.rb @@ -1,4 +1,4 @@ -# frozen-string-literal: true +# frozen_string_literal: true require "active_support/core_ext/string/output_safety" require "set" diff --git a/actionview/lib/action_view/helpers/tags.rb b/actionview/lib/action_view/helpers/tags.rb index a4f6eb0150..ec06617891 100644 --- a/actionview/lib/action_view/helpers/tags.rb +++ b/actionview/lib/action_view/helpers/tags.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags #:nodoc: diff --git a/actionview/lib/action_view/helpers/tags/base.rb b/actionview/lib/action_view/helpers/tags/base.rb index 0895533a60..dec1c1f070 100644 --- a/actionview/lib/action_view/helpers/tags/base.rb +++ b/actionview/lib/action_view/helpers/tags/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/check_box.rb b/actionview/lib/action_view/helpers/tags/check_box.rb index 02f87fc89f..88da221eb2 100644 --- a/actionview/lib/action_view/helpers/tags/check_box.rb +++ b/actionview/lib/action_view/helpers/tags/check_box.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_view/helpers/tags/checkable" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/checkable.rb b/actionview/lib/action_view/helpers/tags/checkable.rb index 052e9df662..a3638aa3fa 100644 --- a/actionview/lib/action_view/helpers/tags/checkable.rb +++ b/actionview/lib/action_view/helpers/tags/checkable.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb b/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb index e02b7bdb2e..1e9f6a1cee 100644 --- a/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb +++ b/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_view/helpers/tags/collection_helpers" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/collection_helpers.rb b/actionview/lib/action_view/helpers/tags/collection_helpers.rb index 75d237eb35..7f0296e466 100644 --- a/actionview/lib/action_view/helpers/tags/collection_helpers.rb +++ b/actionview/lib/action_view/helpers/tags/collection_helpers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb b/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb index f085a5fb73..85648991d7 100644 --- a/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb +++ b/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_view/helpers/tags/collection_helpers" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/collection_select.rb b/actionview/lib/action_view/helpers/tags/collection_select.rb index 4365c714eb..c6a81cf795 100644 --- a/actionview/lib/action_view/helpers/tags/collection_select.rb +++ b/actionview/lib/action_view/helpers/tags/collection_select.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/color_field.rb b/actionview/lib/action_view/helpers/tags/color_field.rb index b4bbe92746..c133fcab77 100644 --- a/actionview/lib/action_view/helpers/tags/color_field.rb +++ b/actionview/lib/action_view/helpers/tags/color_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/date_field.rb b/actionview/lib/action_view/helpers/tags/date_field.rb index c22be0db29..2043a05689 100644 --- a/actionview/lib/action_view/helpers/tags/date_field.rb +++ b/actionview/lib/action_view/helpers/tags/date_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/date_select.rb b/actionview/lib/action_view/helpers/tags/date_select.rb index 638c134deb..fdfcad7e48 100644 --- a/actionview/lib/action_view/helpers/tags/date_select.rb +++ b/actionview/lib/action_view/helpers/tags/date_select.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/time/calculations" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/datetime_field.rb b/actionview/lib/action_view/helpers/tags/datetime_field.rb index b3940c7e44..4686606806 100644 --- a/actionview/lib/action_view/helpers/tags/datetime_field.rb +++ b/actionview/lib/action_view/helpers/tags/datetime_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/datetime_local_field.rb b/actionview/lib/action_view/helpers/tags/datetime_local_field.rb index b4a74185d1..ba0c7fa5f7 100644 --- a/actionview/lib/action_view/helpers/tags/datetime_local_field.rb +++ b/actionview/lib/action_view/helpers/tags/datetime_local_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/datetime_select.rb b/actionview/lib/action_view/helpers/tags/datetime_select.rb index 563de1840e..3a36e47714 100644 --- a/actionview/lib/action_view/helpers/tags/datetime_select.rb +++ b/actionview/lib/action_view/helpers/tags/datetime_select.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/email_field.rb b/actionview/lib/action_view/helpers/tags/email_field.rb index 7ce3ccb9bf..4ba0905cfb 100644 --- a/actionview/lib/action_view/helpers/tags/email_field.rb +++ b/actionview/lib/action_view/helpers/tags/email_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/file_field.rb b/actionview/lib/action_view/helpers/tags/file_field.rb index 476b820d84..201b7fffa5 100644 --- a/actionview/lib/action_view/helpers/tags/file_field.rb +++ b/actionview/lib/action_view/helpers/tags/file_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/grouped_collection_select.rb b/actionview/lib/action_view/helpers/tags/grouped_collection_select.rb index 20e312dd0f..1b3f993b32 100644 --- a/actionview/lib/action_view/helpers/tags/grouped_collection_select.rb +++ b/actionview/lib/action_view/helpers/tags/grouped_collection_select.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/hidden_field.rb b/actionview/lib/action_view/helpers/tags/hidden_field.rb index c3757c2461..ca5cd395a2 100644 --- a/actionview/lib/action_view/helpers/tags/hidden_field.rb +++ b/actionview/lib/action_view/helpers/tags/hidden_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/label.rb b/actionview/lib/action_view/helpers/tags/label.rb index cab15ae201..9f8dac4bbd 100644 --- a/actionview/lib/action_view/helpers/tags/label.rb +++ b/actionview/lib/action_view/helpers/tags/label.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/month_field.rb b/actionview/lib/action_view/helpers/tags/month_field.rb index 4c0fb846ee..ed74ca3f35 100644 --- a/actionview/lib/action_view/helpers/tags/month_field.rb +++ b/actionview/lib/action_view/helpers/tags/month_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/number_field.rb b/actionview/lib/action_view/helpers/tags/number_field.rb index 4f95b1b4de..fc5adfeab1 100644 --- a/actionview/lib/action_view/helpers/tags/number_field.rb +++ b/actionview/lib/action_view/helpers/tags/number_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/password_field.rb b/actionview/lib/action_view/helpers/tags/password_field.rb index 444ef65074..008df0f817 100644 --- a/actionview/lib/action_view/helpers/tags/password_field.rb +++ b/actionview/lib/action_view/helpers/tags/password_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/placeholderable.rb b/actionview/lib/action_view/helpers/tags/placeholderable.rb index cf7b117614..5ae57cdeef 100644 --- a/actionview/lib/action_view/helpers/tags/placeholderable.rb +++ b/actionview/lib/action_view/helpers/tags/placeholderable.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/radio_button.rb b/actionview/lib/action_view/helpers/tags/radio_button.rb index 43dbd32083..538826f749 100644 --- a/actionview/lib/action_view/helpers/tags/radio_button.rb +++ b/actionview/lib/action_view/helpers/tags/radio_button.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_view/helpers/tags/checkable" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/range_field.rb b/actionview/lib/action_view/helpers/tags/range_field.rb index f98ae88043..d7c11cc7a4 100644 --- a/actionview/lib/action_view/helpers/tags/range_field.rb +++ b/actionview/lib/action_view/helpers/tags/range_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/search_field.rb b/actionview/lib/action_view/helpers/tags/search_field.rb index a848aeabfa..38304d8d73 100644 --- a/actionview/lib/action_view/helpers/tags/search_field.rb +++ b/actionview/lib/action_view/helpers/tags/search_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/select.rb b/actionview/lib/action_view/helpers/tags/select.rb index 380f7a8c4e..8c166d630f 100644 --- a/actionview/lib/action_view/helpers/tags/select.rb +++ b/actionview/lib/action_view/helpers/tags/select.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/tel_field.rb b/actionview/lib/action_view/helpers/tags/tel_field.rb index 987bb9e67a..c95127a714 100644 --- a/actionview/lib/action_view/helpers/tags/tel_field.rb +++ b/actionview/lib/action_view/helpers/tags/tel_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/text_area.rb b/actionview/lib/action_view/helpers/tags/text_area.rb index 31e3a9e9b1..6bf3c0c02f 100644 --- a/actionview/lib/action_view/helpers/tags/text_area.rb +++ b/actionview/lib/action_view/helpers/tags/text_area.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_view/helpers/tags/placeholderable" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/text_field.rb b/actionview/lib/action_view/helpers/tags/text_field.rb index 613cade7b3..48930770be 100644 --- a/actionview/lib/action_view/helpers/tags/text_field.rb +++ b/actionview/lib/action_view/helpers/tags/text_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_view/helpers/tags/placeholderable" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/time_field.rb b/actionview/lib/action_view/helpers/tags/time_field.rb index 0e90a3aed7..8c3f082359 100644 --- a/actionview/lib/action_view/helpers/tags/time_field.rb +++ b/actionview/lib/action_view/helpers/tags/time_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/time_select.rb b/actionview/lib/action_view/helpers/tags/time_select.rb index 0b06311d25..d46728698f 100644 --- a/actionview/lib/action_view/helpers/tags/time_select.rb +++ b/actionview/lib/action_view/helpers/tags/time_select.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/time_zone_select.rb b/actionview/lib/action_view/helpers/tags/time_zone_select.rb index 80d165ec7e..49e099d38a 100644 --- a/actionview/lib/action_view/helpers/tags/time_zone_select.rb +++ b/actionview/lib/action_view/helpers/tags/time_zone_select.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/translator.rb b/actionview/lib/action_view/helpers/tags/translator.rb index ced835eaa8..0d3ac24689 100644 --- a/actionview/lib/action_view/helpers/tags/translator.rb +++ b/actionview/lib/action_view/helpers/tags/translator.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/url_field.rb b/actionview/lib/action_view/helpers/tags/url_field.rb index d76340178d..4c474a579f 100644 --- a/actionview/lib/action_view/helpers/tags/url_field.rb +++ b/actionview/lib/action_view/helpers/tags/url_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/week_field.rb b/actionview/lib/action_view/helpers/tags/week_field.rb index 835d1667d7..08c6fbb81d 100644 --- a/actionview/lib/action_view/helpers/tags/week_field.rb +++ b/actionview/lib/action_view/helpers/tags/week_field.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/text_helper.rb b/actionview/lib/action_view/helpers/text_helper.rb index bc922f9ce8..4fce229276 100644 --- a/actionview/lib/action_view/helpers/text_helper.rb +++ b/actionview/lib/action_view/helpers/text_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/string/filters" require "active_support/core_ext/array/extract_options" diff --git a/actionview/lib/action_view/helpers/translation_helper.rb b/actionview/lib/action_view/helpers/translation_helper.rb index cc928f2b7a..a1f8b6307c 100644 --- a/actionview/lib/action_view/helpers/translation_helper.rb +++ b/actionview/lib/action_view/helpers/translation_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_view/helpers/tag_helper" require "active_support/core_ext/string/access" require "i18n/exceptions" diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb index b78c367921..6bdb8e90ff 100644 --- a/actionview/lib/action_view/helpers/url_helper.rb +++ b/actionview/lib/action_view/helpers/url_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_view/helpers/javascript_helper" require "active_support/core_ext/array/access" require "active_support/core_ext/hash/keys" diff --git a/actionview/lib/action_view/layouts.rb b/actionview/lib/action_view/layouts.rb index ab8409e8d0..f5681668e5 100644 --- a/actionview/lib/action_view/layouts.rb +++ b/actionview/lib/action_view/layouts.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_view/rendering" require "active_support/core_ext/module/remove_method" diff --git a/actionview/lib/action_view/log_subscriber.rb b/actionview/lib/action_view/log_subscriber.rb index ab8ec0aa42..dd8729adf7 100644 --- a/actionview/lib/action_view/log_subscriber.rb +++ b/actionview/lib/action_view/log_subscriber.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/log_subscriber" module ActionView diff --git a/actionview/lib/action_view/lookup_context.rb b/actionview/lib/action_view/lookup_context.rb index b7dbb38369..0220ac3a42 100644 --- a/actionview/lib/action_view/lookup_context.rb +++ b/actionview/lib/action_view/lookup_context.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "concurrent/map" require "active_support/core_ext/module/remove_method" require "active_support/core_ext/module/attribute_accessors" diff --git a/actionview/lib/action_view/model_naming.rb b/actionview/lib/action_view/model_naming.rb index b6ed13424e..5eab00cd1a 100644 --- a/actionview/lib/action_view/model_naming.rb +++ b/actionview/lib/action_view/model_naming.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module ModelNaming #:nodoc: # Converts the given object to an ActiveModel compliant one. diff --git a/actionview/lib/action_view/path_set.rb b/actionview/lib/action_view/path_set.rb index 6688519ffd..0ac5778273 100644 --- a/actionview/lib/action_view/path_set.rb +++ b/actionview/lib/action_view/path_set.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView #:nodoc: # = Action View PathSet # diff --git a/actionview/lib/action_view/railtie.rb b/actionview/lib/action_view/railtie.rb index 61678933e9..3971dc0aed 100644 --- a/actionview/lib/action_view/railtie.rb +++ b/actionview/lib/action_view/railtie.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_view" require "rails" diff --git a/actionview/lib/action_view/record_identifier.rb b/actionview/lib/action_view/record_identifier.rb index 48bea315a9..885f935248 100644 --- a/actionview/lib/action_view/record_identifier.rb +++ b/actionview/lib/action_view/record_identifier.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/module" require "action_view/model_naming" diff --git a/actionview/lib/action_view/renderer/abstract_renderer.rb b/actionview/lib/action_view/renderer/abstract_renderer.rb index 0b315eb569..217b05b5f3 100644 --- a/actionview/lib/action_view/renderer/abstract_renderer.rb +++ b/actionview/lib/action_view/renderer/abstract_renderer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView # This class defines the interface for a renderer. Each class that # subclasses +AbstractRenderer+ is used by the base +Renderer+ class to diff --git a/actionview/lib/action_view/renderer/partial_renderer.rb b/actionview/lib/action_view/renderer/partial_renderer.rb index 1f8f997a2d..0bc414677f 100644 --- a/actionview/lib/action_view/renderer/partial_renderer.rb +++ b/actionview/lib/action_view/renderer/partial_renderer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "concurrent/map" require "action_view/renderer/partial_renderer/collection_caching" diff --git a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb index 32663fb80d..61cb6c90b9 100644 --- a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb +++ b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module CollectionCaching # :nodoc: extend ActiveSupport::Concern diff --git a/actionview/lib/action_view/renderer/renderer.rb b/actionview/lib/action_view/renderer/renderer.rb index bcdeb85d30..07461d3e2e 100644 --- a/actionview/lib/action_view/renderer/renderer.rb +++ b/actionview/lib/action_view/renderer/renderer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView # This is the main entry point for rendering. It basically delegates # to other objects like TemplateRenderer and PartialRenderer which diff --git a/actionview/lib/action_view/renderer/streaming_template_renderer.rb b/actionview/lib/action_view/renderer/streaming_template_renderer.rb index 62ce985243..40d7ce63a6 100644 --- a/actionview/lib/action_view/renderer/streaming_template_renderer.rb +++ b/actionview/lib/action_view/renderer/streaming_template_renderer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "fiber" module ActionView diff --git a/actionview/lib/action_view/renderer/template_renderer.rb b/actionview/lib/action_view/renderer/template_renderer.rb index 54317199de..1fe95a5f67 100644 --- a/actionview/lib/action_view/renderer/template_renderer.rb +++ b/actionview/lib/action_view/renderer/template_renderer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/object/try" module ActionView diff --git a/actionview/lib/action_view/rendering.rb b/actionview/lib/action_view/rendering.rb index cf18562c45..29cdbf37cb 100644 --- a/actionview/lib/action_view/rendering.rb +++ b/actionview/lib/action_view/rendering.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_view/view_paths" module ActionView diff --git a/actionview/lib/action_view/routing_url_for.rb b/actionview/lib/action_view/routing_url_for.rb index 687ba7c1b4..3f6b59cf98 100644 --- a/actionview/lib/action_view/routing_url_for.rb +++ b/actionview/lib/action_view/routing_url_for.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_dispatch/routing/polymorphic_routes" module ActionView diff --git a/actionview/lib/action_view/tasks/cache_digests.rake b/actionview/lib/action_view/tasks/cache_digests.rake index d30b3f7797..929bace6d4 100644 --- a/actionview/lib/action_view/tasks/cache_digests.rake +++ b/actionview/lib/action_view/tasks/cache_digests.rake @@ -1,3 +1,4 @@ +# frozen_string_literal: true namespace :cache_digests do desc "Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)" task nested_dependencies: :environment do diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index b0e2f1e54e..ccd8af2559 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/object/try" require "active_support/core_ext/kernel/singleton_class" require "thread" diff --git a/actionview/lib/action_view/template/error.rb b/actionview/lib/action_view/template/error.rb index cc90477190..c2f13eb77c 100644 --- a/actionview/lib/action_view/template/error.rb +++ b/actionview/lib/action_view/template/error.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/enumerable" module ActionView diff --git a/actionview/lib/action_view/template/handlers.rb b/actionview/lib/action_view/template/handlers.rb index f4301f6f07..d5300ea659 100644 --- a/actionview/lib/action_view/template/handlers.rb +++ b/actionview/lib/action_view/template/handlers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView #:nodoc: # = Action View Template Handlers class Template diff --git a/actionview/lib/action_view/template/handlers/builder.rb b/actionview/lib/action_view/template/handlers/builder.rb index 67ad78133d..f8f5b96704 100644 --- a/actionview/lib/action_view/template/handlers/builder.rb +++ b/actionview/lib/action_view/template/handlers/builder.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Template::Handlers class Builder diff --git a/actionview/lib/action_view/template/handlers/erb.rb b/actionview/lib/action_view/template/handlers/erb.rb index 48c2e22a89..fc2a901fa9 100644 --- a/actionview/lib/action_view/template/handlers/erb.rb +++ b/actionview/lib/action_view/template/handlers/erb.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView class Template module Handlers diff --git a/actionview/lib/action_view/template/handlers/erb/deprecated_erubis.rb b/actionview/lib/action_view/template/handlers/erb/deprecated_erubis.rb index 427ea20064..59d6018f93 100644 --- a/actionview/lib/action_view/template/handlers/erb/deprecated_erubis.rb +++ b/actionview/lib/action_view/template/handlers/erb/deprecated_erubis.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true ::ActiveSupport::Deprecation.warn("ActionView::Template::Handlers::Erubis is deprecated and will be removed from Rails 5.2. Switch to ActionView::Template::Handlers::ERB::Erubi instead.") module ActionView diff --git a/actionview/lib/action_view/template/handlers/erb/erubi.rb b/actionview/lib/action_view/template/handlers/erb/erubi.rb index 755cc84015..85750d57ca 100644 --- a/actionview/lib/action_view/template/handlers/erb/erubi.rb +++ b/actionview/lib/action_view/template/handlers/erb/erubi.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "erubi" module ActionView diff --git a/actionview/lib/action_view/template/handlers/erb/erubis.rb b/actionview/lib/action_view/template/handlers/erb/erubis.rb index f3c35e1aec..43a3731f8b 100644 --- a/actionview/lib/action_view/template/handlers/erb/erubis.rb +++ b/actionview/lib/action_view/template/handlers/erb/erubis.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true gem "erubis" require "erubis" diff --git a/actionview/lib/action_view/template/handlers/html.rb b/actionview/lib/action_view/template/handlers/html.rb index ccaa8d1469..215de5cfa2 100644 --- a/actionview/lib/action_view/template/handlers/html.rb +++ b/actionview/lib/action_view/template/handlers/html.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Template::Handlers class Html < Raw diff --git a/actionview/lib/action_view/template/handlers/raw.rb b/actionview/lib/action_view/template/handlers/raw.rb index e7519e94f9..6fc46aaa93 100644 --- a/actionview/lib/action_view/template/handlers/raw.rb +++ b/actionview/lib/action_view/template/handlers/raw.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module Template::Handlers class Raw diff --git a/actionview/lib/action_view/template/html.rb b/actionview/lib/action_view/template/html.rb index 0ffae10432..e2d2d05ec7 100644 --- a/actionview/lib/action_view/template/html.rb +++ b/actionview/lib/action_view/template/html.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView #:nodoc: # = Action View HTML Template class Template diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb index 75ea4d31f5..32d2db3e57 100644 --- a/actionview/lib/action_view/template/resolver.rb +++ b/actionview/lib/action_view/template/resolver.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "pathname" require "active_support/core_ext/class" require "active_support/core_ext/module/attribute_accessors" diff --git a/actionview/lib/action_view/template/text.rb b/actionview/lib/action_view/template/text.rb index 380528d6ef..8249b27aa0 100644 --- a/actionview/lib/action_view/template/text.rb +++ b/actionview/lib/action_view/template/text.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView #:nodoc: # = Action View Text Template class Template diff --git a/actionview/lib/action_view/template/types.rb b/actionview/lib/action_view/template/types.rb index 21959a3798..6f00fd0a3b 100644 --- a/actionview/lib/action_view/template/types.rb +++ b/actionview/lib/action_view/template/types.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/module/attribute_accessors" module ActionView diff --git a/actionview/lib/action_view/test_case.rb b/actionview/lib/action_view/test_case.rb index 80403799ab..f149d66bf9 100644 --- a/actionview/lib/action_view/test_case.rb +++ b/actionview/lib/action_view/test_case.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/module/remove_method" require "action_controller" require "action_controller/test_case" diff --git a/actionview/lib/action_view/testing/resolvers.rb b/actionview/lib/action_view/testing/resolvers.rb index 3188526b63..4e7fe43066 100644 --- a/actionview/lib/action_view/testing/resolvers.rb +++ b/actionview/lib/action_view/testing/resolvers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "action_view/template/resolver" module ActionView #:nodoc: diff --git a/actionview/lib/action_view/version.rb b/actionview/lib/action_view/version.rb index 315404864d..3d4e517f99 100644 --- a/actionview/lib/action_view/version.rb +++ b/actionview/lib/action_view/version.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require_relative "gem_version" module ActionView diff --git a/actionview/lib/action_view/view_paths.rb b/actionview/lib/action_view/view_paths.rb index 938f0fc17f..bbff56f88d 100644 --- a/actionview/lib/action_view/view_paths.rb +++ b/actionview/lib/action_view/view_paths.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ActionView module ViewPaths extend ActiveSupport::Concern diff --git a/actionview/test/abstract_unit.rb b/actionview/test/abstract_unit.rb index a7d706c5e1..da554b830c 100644 --- a/actionview/test/abstract_unit.rb +++ b/actionview/test/abstract_unit.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true $:.unshift File.expand_path("lib", __dir__) $:.unshift File.expand_path("fixtures/helpers", __dir__) $:.unshift File.expand_path("fixtures/alternate_helpers", __dir__) diff --git a/actionview/test/actionpack/abstract/abstract_controller_test.rb b/actionview/test/actionpack/abstract/abstract_controller_test.rb index 8f65a61493..7714f97605 100644 --- a/actionview/test/actionpack/abstract/abstract_controller_test.rb +++ b/actionview/test/actionpack/abstract/abstract_controller_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "set" diff --git a/actionview/test/actionpack/abstract/helper_test.rb b/actionview/test/actionpack/abstract/helper_test.rb index 13922e4485..e3a1614057 100644 --- a/actionview/test/actionpack/abstract/helper_test.rb +++ b/actionview/test/actionpack/abstract/helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" ActionController::Base.helpers_path = File.expand_path("../../fixtures/helpers", __dir__) diff --git a/actionview/test/actionpack/abstract/layouts_test.rb b/actionview/test/actionpack/abstract/layouts_test.rb index 4ece992597..e733dc43af 100644 --- a/actionview/test/actionpack/abstract/layouts_test.rb +++ b/actionview/test/actionpack/abstract/layouts_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" module AbstractControllerTests diff --git a/actionview/test/actionpack/abstract/render_test.rb b/actionview/test/actionpack/abstract/render_test.rb index 8b0c54fb77..017e9ed2ff 100644 --- a/actionview/test/actionpack/abstract/render_test.rb +++ b/actionview/test/actionpack/abstract/render_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" module AbstractController diff --git a/actionview/test/actionpack/controller/capture_test.rb b/actionview/test/actionpack/controller/capture_test.rb index cc3a23c60c..19167333ae 100644 --- a/actionview/test/actionpack/controller/capture_test.rb +++ b/actionview/test/actionpack/controller/capture_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/logger" diff --git a/actionview/test/actionpack/controller/layout_test.rb b/actionview/test/actionpack/controller/layout_test.rb index b3e0329f57..8af6539056 100644 --- a/actionview/test/actionpack/controller/layout_test.rb +++ b/actionview/test/actionpack/controller/layout_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array/extract_options" diff --git a/actionview/test/actionpack/controller/render_test.rb b/actionview/test/actionpack/controller/render_test.rb index 6528169312..c7990f8d96 100644 --- a/actionview/test/actionpack/controller/render_test.rb +++ b/actionview/test/actionpack/controller/render_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_model" require "controller/fake_models" diff --git a/actionview/test/actionpack/controller/view_paths_test.rb b/actionview/test/actionpack/controller/view_paths_test.rb index 4c58b959a9..a0e9842dbf 100644 --- a/actionview/test/actionpack/controller/view_paths_test.rb +++ b/actionview/test/actionpack/controller/view_paths_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class ViewLoadPathsTest < ActionController::TestCase diff --git a/actionview/test/active_record_unit.rb b/actionview/test/active_record_unit.rb index 901c0e2b3e..23d5d9814f 100644 --- a/actionview/test/active_record_unit.rb +++ b/actionview/test/active_record_unit.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" # Define the essentials diff --git a/actionview/test/activerecord/controller_runtime_test.rb b/actionview/test/activerecord/controller_runtime_test.rb index 1cec5072c0..176d9e6d8c 100644 --- a/actionview/test/activerecord/controller_runtime_test.rb +++ b/actionview/test/activerecord/controller_runtime_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record_unit" require "active_record/railties/controller_runtime" require "fixtures/project" diff --git a/actionview/test/activerecord/debug_helper_test.rb b/actionview/test/activerecord/debug_helper_test.rb index 06ae555a03..6ada7a3e42 100644 --- a/actionview/test/activerecord/debug_helper_test.rb +++ b/actionview/test/activerecord/debug_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record_unit" require "nokogiri" diff --git a/actionview/test/activerecord/form_helper_activerecord_test.rb b/actionview/test/activerecord/form_helper_activerecord_test.rb index 3b314588c7..291568c672 100644 --- a/actionview/test/activerecord/form_helper_activerecord_test.rb +++ b/actionview/test/activerecord/form_helper_activerecord_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record_unit" require "fixtures/project" require "fixtures/developer" diff --git a/actionview/test/activerecord/polymorphic_routes_test.rb b/actionview/test/activerecord/polymorphic_routes_test.rb index b2e0fb08c4..2fd538fee0 100644 --- a/actionview/test/activerecord/polymorphic_routes_test.rb +++ b/actionview/test/activerecord/polymorphic_routes_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record_unit" require "fixtures/project" diff --git a/actionview/test/activerecord/relation_cache_test.rb b/actionview/test/activerecord/relation_cache_test.rb index d12c426586..a6d8f2d278 100644 --- a/actionview/test/activerecord/relation_cache_test.rb +++ b/actionview/test/activerecord/relation_cache_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record_unit" class RelationCacheTest < ActionView::TestCase diff --git a/actionview/test/activerecord/render_partial_with_record_identification_test.rb b/actionview/test/activerecord/render_partial_with_record_identification_test.rb index 60c3ab3045..88e72599d4 100644 --- a/actionview/test/activerecord/render_partial_with_record_identification_test.rb +++ b/actionview/test/activerecord/render_partial_with_record_identification_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_record_unit" class RenderPartialWithRecordIdentificationController < ActionController::Base diff --git a/actionview/test/fixtures/actionpack/layouts/builder.builder b/actionview/test/fixtures/actionpack/layouts/builder.builder index c55488edd0..0f34d03a4c 100644 --- a/actionview/test/fixtures/actionpack/layouts/builder.builder +++ b/actionview/test/fixtures/actionpack/layouts/builder.builder @@ -1,3 +1,4 @@ +# frozen_string_literal: true xml.wrapper do xml << yield end diff --git a/actionview/test/fixtures/actionpack/test/_hello.builder b/actionview/test/fixtures/actionpack/test/_hello.builder index fc72df16d0..a767060f3c 100644 --- a/actionview/test/fixtures/actionpack/test/_hello.builder +++ b/actionview/test/fixtures/actionpack/test/_hello.builder @@ -1 +1,2 @@ +# frozen_string_literal: true xm.hello diff --git a/actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder b/actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder index f98aaa34a5..568a2ddefe 100644 --- a/actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder +++ b/actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder @@ -1 +1,2 @@ +# frozen_string_literal: true xml.test "failed" diff --git a/actionview/test/fixtures/actionpack/test/hello.builder b/actionview/test/fixtures/actionpack/test/hello.builder index b8ab17ad5b..205ad8722f 100644 --- a/actionview/test/fixtures/actionpack/test/hello.builder +++ b/actionview/test/fixtures/actionpack/test/hello.builder @@ -1,3 +1,4 @@ +# frozen_string_literal: true xml.html do xml.p "Hello #{@name}" xml << render(file: "test/greeting") diff --git a/actionview/test/fixtures/actionpack/test/hello_world_container.builder b/actionview/test/fixtures/actionpack/test/hello_world_container.builder index 24032ab5e0..f0291694ee 100644 --- a/actionview/test/fixtures/actionpack/test/hello_world_container.builder +++ b/actionview/test/fixtures/actionpack/test/hello_world_container.builder @@ -1,3 +1,4 @@ +# frozen_string_literal: true xml.test do render partial: "hello", locals: { xm: xml } end diff --git a/actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder b/actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder index 619a97ba96..2a87fd1a3d 100644 --- a/actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder +++ b/actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder @@ -1,3 +1,4 @@ +# frozen_string_literal: true xml.html do xml.p "Hello" end diff --git a/actionview/test/fixtures/actionpack/test/hello_xml_world.builder b/actionview/test/fixtures/actionpack/test/hello_xml_world.builder index d16bb6b5cb..c496fb4160 100644 --- a/actionview/test/fixtures/actionpack/test/hello_xml_world.builder +++ b/actionview/test/fixtures/actionpack/test/hello_xml_world.builder @@ -1,3 +1,4 @@ +# frozen_string_literal: true xml.html do xml.head do xml.title "Hello World" diff --git a/actionview/test/fixtures/actionpack/test/implicit_content_type.atom.builder b/actionview/test/fixtures/actionpack/test/implicit_content_type.atom.builder index 2fcb32d247..bcb3c79f0b 100644 --- a/actionview/test/fixtures/actionpack/test/implicit_content_type.atom.builder +++ b/actionview/test/fixtures/actionpack/test/implicit_content_type.atom.builder @@ -1,2 +1,3 @@ +# frozen_string_literal: true xml.atom do end diff --git a/actionview/test/fixtures/actionpack/test/non_erb_block_content_for.builder b/actionview/test/fixtures/actionpack/test/non_erb_block_content_for.builder index cd65da751b..4db7d66d90 100644 --- a/actionview/test/fixtures/actionpack/test/non_erb_block_content_for.builder +++ b/actionview/test/fixtures/actionpack/test/non_erb_block_content_for.builder @@ -1,3 +1,4 @@ +# frozen_string_literal: true content_for :title do "Putting stuff in the title!" end diff --git a/actionview/test/fixtures/comments/empty.html.builder b/actionview/test/fixtures/comments/empty.html.builder index 12d6fdd9a5..ecc1078747 100644 --- a/actionview/test/fixtures/comments/empty.html.builder +++ b/actionview/test/fixtures/comments/empty.html.builder @@ -1 +1,2 @@ +# frozen_string_literal: true xml.h1 "No Comment" diff --git a/actionview/test/fixtures/company.rb b/actionview/test/fixtures/company.rb index 9f527acdd8..18a197947a 100644 --- a/actionview/test/fixtures/company.rb +++ b/actionview/test/fixtures/company.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Company < ActiveRecord::Base has_one :mascot self.sequence_name = :companies_nonstd_seq diff --git a/actionview/test/fixtures/developer.rb b/actionview/test/fixtures/developer.rb index 1a686a33ce..59f5f17efe 100644 --- a/actionview/test/fixtures/developer.rb +++ b/actionview/test/fixtures/developer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Developer < ActiveRecord::Base has_and_belongs_to_many :projects has_many :replies diff --git a/actionview/test/fixtures/helpers/abc_helper.rb b/actionview/test/fixtures/helpers/abc_helper.rb index cf2774bb5f..a743c7ee9a 100644 --- a/actionview/test/fixtures/helpers/abc_helper.rb +++ b/actionview/test/fixtures/helpers/abc_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module AbcHelper def bare_a() end end diff --git a/actionview/test/fixtures/helpers/helpery_test_helper.rb b/actionview/test/fixtures/helpers/helpery_test_helper.rb index a4f2951efa..af67fe1c5c 100644 --- a/actionview/test/fixtures/helpers/helpery_test_helper.rb +++ b/actionview/test/fixtures/helpers/helpery_test_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module HelperyTestHelper def helpery_test "Default" diff --git a/actionview/test/fixtures/helpers_missing/invalid_require_helper.rb b/actionview/test/fixtures/helpers_missing/invalid_require_helper.rb index 6ac6677daa..d1d66a7161 100644 --- a/actionview/test/fixtures/helpers_missing/invalid_require_helper.rb +++ b/actionview/test/fixtures/helpers_missing/invalid_require_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "very_invalid_file_name" module InvalidRequireHelper diff --git a/actionview/test/fixtures/mascot.rb b/actionview/test/fixtures/mascot.rb index 1c0bd7c8fd..212303b838 100644 --- a/actionview/test/fixtures/mascot.rb +++ b/actionview/test/fixtures/mascot.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Mascot < ActiveRecord::Base belongs_to :company end diff --git a/actionview/test/fixtures/project.rb b/actionview/test/fixtures/project.rb index 404b12cbab..a9e4bb44d6 100644 --- a/actionview/test/fixtures/project.rb +++ b/actionview/test/fixtures/project.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Project < ActiveRecord::Base has_and_belongs_to_many :developers, -> { uniq } diff --git a/actionview/test/fixtures/reply.rb b/actionview/test/fixtures/reply.rb index 047522c55b..e9a7828d2d 100644 --- a/actionview/test/fixtures/reply.rb +++ b/actionview/test/fixtures/reply.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Reply < ActiveRecord::Base scope :base, -> { all } belongs_to :topic, -> { includes(:replies) } diff --git a/actionview/test/fixtures/ruby_template.ruby b/actionview/test/fixtures/ruby_template.ruby index 5097bce47c..cae21339f5 100644 --- a/actionview/test/fixtures/ruby_template.ruby +++ b/actionview/test/fixtures/ruby_template.ruby @@ -1,2 +1,3 @@ +# frozen_string_literal: true body = "" body << ["Hello", "from", "Ruby", "code"].join(" ") diff --git a/actionview/test/fixtures/test/hello.builder b/actionview/test/fixtures/test/hello.builder index b8ab17ad5b..205ad8722f 100644 --- a/actionview/test/fixtures/test/hello.builder +++ b/actionview/test/fixtures/test/hello.builder @@ -1,3 +1,4 @@ +# frozen_string_literal: true xml.html do xml.p "Hello #{@name}" xml << render(file: "test/greeting") diff --git a/actionview/test/fixtures/topic.rb b/actionview/test/fixtures/topic.rb index 48a3dfba88..7e66f53bd5 100644 --- a/actionview/test/fixtures/topic.rb +++ b/actionview/test/fixtures/topic.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Topic < ActiveRecord::Base has_many :replies, dependent: :destroy end diff --git a/actionview/test/lib/controller/fake_models.rb b/actionview/test/lib/controller/fake_models.rb index 5250101220..c419984997 100644 --- a/actionview/test/lib/controller/fake_models.rb +++ b/actionview/test/lib/controller/fake_models.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_model" Customer = Struct.new(:name, :id) do diff --git a/actionview/test/template/active_model_helper_test.rb b/actionview/test/template/active_model_helper_test.rb index 6b63aa25a5..030c36b1b2 100644 --- a/actionview/test/template/active_model_helper_test.rb +++ b/actionview/test/template/active_model_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class ActiveModelHelperTest < ActionView::TestCase diff --git a/actionview/test/template/asset_tag_helper_test.rb b/actionview/test/template/asset_tag_helper_test.rb index 6093a4e660..5bdcbda72e 100644 --- a/actionview/test/template/asset_tag_helper_test.rb +++ b/actionview/test/template/asset_tag_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/ordered_options" diff --git a/actionview/test/template/atom_feed_helper_test.rb b/actionview/test/template/atom_feed_helper_test.rb index 7304b769a4..4a1188922c 100644 --- a/actionview/test/template/atom_feed_helper_test.rb +++ b/actionview/test/template/atom_feed_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" Scroll = Struct.new(:id, :to_param, :title, :body, :updated_at, :created_at) do diff --git a/actionview/test/template/capture_helper_test.rb b/actionview/test/template/capture_helper_test.rb index 7f37523eeb..657fda405e 100644 --- a/actionview/test/template/capture_helper_test.rb +++ b/actionview/test/template/capture_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class CaptureHelperTest < ActionView::TestCase diff --git a/actionview/test/template/compiled_templates_test.rb b/actionview/test/template/compiled_templates_test.rb index adb2be9be4..5135b1e90b 100644 --- a/actionview/test/template/compiled_templates_test.rb +++ b/actionview/test/template/compiled_templates_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class CompiledTemplatesTest < ActiveSupport::TestCase diff --git a/actionview/test/template/controller_helper_test.rb b/actionview/test/template/controller_helper_test.rb index 8dd0cedb75..1b6f1b95c2 100644 --- a/actionview/test/template/controller_helper_test.rb +++ b/actionview/test/template/controller_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class ControllerHelperTest < ActionView::TestCase diff --git a/actionview/test/template/date_helper_i18n_test.rb b/actionview/test/template/date_helper_i18n_test.rb index 207c8a683e..eee4340958 100644 --- a/actionview/test/template/date_helper_i18n_test.rb +++ b/actionview/test/template/date_helper_i18n_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class DateHelperDistanceOfTimeInWordsI18nTests < ActiveSupport::TestCase diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb index b667303318..72573917fa 100644 --- a/actionview/test/template/date_helper_test.rb +++ b/actionview/test/template/date_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class DateHelperTest < ActionView::TestCase diff --git a/actionview/test/template/dependency_tracker_test.rb b/actionview/test/template/dependency_tracker_test.rb index 89917035ff..f3c1ab4fbf 100644 --- a/actionview/test/template/dependency_tracker_test.rb +++ b/actionview/test/template/dependency_tracker_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "action_view/dependency_tracker" diff --git a/actionview/test/template/digestor_test.rb b/actionview/test/template/digestor_test.rb index de04f3f25d..b8cae0ab66 100644 --- a/actionview/test/template/digestor_test.rb +++ b/actionview/test/template/digestor_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "fileutils" require "action_view/dependency_tracker" diff --git a/actionview/test/template/erb/deprecated_erubis_implementation_test.rb b/actionview/test/template/erb/deprecated_erubis_implementation_test.rb index aaf99f85c0..511dbf8008 100644 --- a/actionview/test/template/erb/deprecated_erubis_implementation_test.rb +++ b/actionview/test/template/erb/deprecated_erubis_implementation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" module ERBTest diff --git a/actionview/test/template/erb/form_for_test.rb b/actionview/test/template/erb/form_for_test.rb index e722b40a9a..e251083fc8 100644 --- a/actionview/test/template/erb/form_for_test.rb +++ b/actionview/test/template/erb/form_for_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "template/erb/helper" diff --git a/actionview/test/template/erb/helper.rb b/actionview/test/template/erb/helper.rb index bc1eedc15f..78fc0d4290 100644 --- a/actionview/test/template/erb/helper.rb +++ b/actionview/test/template/erb/helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ERBTest class ViewContext include ActionView::Helpers::UrlHelper diff --git a/actionview/test/template/erb/tag_helper_test.rb b/actionview/test/template/erb/tag_helper_test.rb index 233f37c48a..65ded0aaf5 100644 --- a/actionview/test/template/erb/tag_helper_test.rb +++ b/actionview/test/template/erb/tag_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "template/erb/helper" diff --git a/actionview/test/template/erb_util_test.rb b/actionview/test/template/erb_util_test.rb index 4412ea37fa..69d092b6c6 100644 --- a/actionview/test/template/erb_util_test.rb +++ b/actionview/test/template/erb_util_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/json" diff --git a/actionview/test/template/form_collections_helper_test.rb b/actionview/test/template/form_collections_helper_test.rb index 6160524eb3..ddc2619e7a 100644 --- a/actionview/test/template/form_collections_helper_test.rb +++ b/actionview/test/template/form_collections_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" Category = Struct.new(:id, :name) diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb index ecdd5ce672..d62edf5dd9 100644 --- a/actionview/test/template/form_helper/form_with_test.rb +++ b/actionview/test/template/form_helper/form_with_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "controller/fake_models" diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb index b3a180b28a..8c06a6260f 100644 --- a/actionview/test/template/form_helper_test.rb +++ b/actionview/test/template/form_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "controller/fake_models" diff --git a/actionview/test/template/form_options_helper_i18n_test.rb b/actionview/test/template/form_options_helper_i18n_test.rb index a1048fbb89..e23bd94307 100644 --- a/actionview/test/template/form_options_helper_i18n_test.rb +++ b/actionview/test/template/form_options_helper_i18n_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class FormOptionsHelperI18nTests < ActionView::TestCase diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb index 3247f20ba7..faeb84faef 100644 --- a/actionview/test/template/form_options_helper_test.rb +++ b/actionview/test/template/form_options_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class Map < Hash diff --git a/actionview/test/template/form_tag_helper_test.rb b/actionview/test/template/form_tag_helper_test.rb index 084c540139..bbcb523771 100644 --- a/actionview/test/template/form_tag_helper_test.rb +++ b/actionview/test/template/form_tag_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class FormTagHelperTest < ActionView::TestCase diff --git a/actionview/test/template/html_test.rb b/actionview/test/template/html_test.rb index 60f4b0aee6..17560287bc 100644 --- a/actionview/test/template/html_test.rb +++ b/actionview/test/template/html_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class HTMLTest < ActiveSupport::TestCase diff --git a/actionview/test/template/javascript_helper_test.rb b/actionview/test/template/javascript_helper_test.rb index c7670b056b..fef2625114 100644 --- a/actionview/test/template/javascript_helper_test.rb +++ b/actionview/test/template/javascript_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class JavaScriptHelperTest < ActionView::TestCase diff --git a/actionview/test/template/log_subscriber_test.rb b/actionview/test/template/log_subscriber_test.rb index 4c9f84f277..765f644bb4 100644 --- a/actionview/test/template/log_subscriber_test.rb +++ b/actionview/test/template/log_subscriber_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/log_subscriber/test_helper" require "action_view/log_subscriber" diff --git a/actionview/test/template/lookup_context_test.rb b/actionview/test/template/lookup_context_test.rb index b47d92df34..b55f68e36b 100644 --- a/actionview/test/template/lookup_context_test.rb +++ b/actionview/test/template/lookup_context_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "abstract_controller/rendering" diff --git a/actionview/test/template/number_helper_test.rb b/actionview/test/template/number_helper_test.rb index 678120a9c9..9077dbb0c8 100644 --- a/actionview/test/template/number_helper_test.rb +++ b/actionview/test/template/number_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class NumberHelperTest < ActionView::TestCase diff --git a/actionview/test/template/output_safety_helper_test.rb b/actionview/test/template/output_safety_helper_test.rb index 537b4393ee..3b4b83110c 100644 --- a/actionview/test/template/output_safety_helper_test.rb +++ b/actionview/test/template/output_safety_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class OutputSafetyHelperTest < ActionView::TestCase diff --git a/actionview/test/template/partial_iteration_test.rb b/actionview/test/template/partial_iteration_test.rb index 3ebf3b550a..3a31134e5b 100644 --- a/actionview/test/template/partial_iteration_test.rb +++ b/actionview/test/template/partial_iteration_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "action_view/renderer/partial_renderer" diff --git a/actionview/test/template/record_identifier_test.rb b/actionview/test/template/record_identifier_test.rb index ce446715fd..529de9a57b 100644 --- a/actionview/test/template/record_identifier_test.rb +++ b/actionview/test/template/record_identifier_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "controller/fake_models" diff --git a/actionview/test/template/record_tag_helper_test.rb b/actionview/test/template/record_tag_helper_test.rb index 3685230558..ab110d8314 100644 --- a/actionview/test/template/record_tag_helper_test.rb +++ b/actionview/test/template/record_tag_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class RecordTagPost diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 9999607067..3f7e671faf 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "controller/fake_models" diff --git a/actionview/test/template/resolver_cache_test.rb b/actionview/test/template/resolver_cache_test.rb index 0ecfccd375..b881618a1d 100644 --- a/actionview/test/template/resolver_cache_test.rb +++ b/actionview/test/template/resolver_cache_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class ResolverCacheTest < ActiveSupport::TestCase diff --git a/actionview/test/template/resolver_patterns_test.rb b/actionview/test/template/resolver_patterns_test.rb index 8e21f4b828..f5a28be400 100644 --- a/actionview/test/template/resolver_patterns_test.rb +++ b/actionview/test/template/resolver_patterns_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class ResolverPatternsTest < ActiveSupport::TestCase diff --git a/actionview/test/template/sanitize_helper_test.rb b/actionview/test/template/sanitize_helper_test.rb index 4d4ed3c35c..8ca8cb6d17 100644 --- a/actionview/test/template/sanitize_helper_test.rb +++ b/actionview/test/template/sanitize_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" # The exhaustive tests are in the rails-html-sanitizer gem. diff --git a/actionview/test/template/streaming_render_test.rb b/actionview/test/template/streaming_render_test.rb index 6ce66a1275..098c2e7551 100644 --- a/actionview/test/template/streaming_render_test.rb +++ b/actionview/test/template/streaming_render_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class TestController < ActionController::Base diff --git a/actionview/test/template/tag_helper_test.rb b/actionview/test/template/tag_helper_test.rb index f1e5946e14..d338ff9d3f 100644 --- a/actionview/test/template/tag_helper_test.rb +++ b/actionview/test/template/tag_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class TagHelperTest < ActionView::TestCase diff --git a/actionview/test/template/template_error_test.rb b/actionview/test/template/template_error_test.rb index 54c1d53b60..a5201edfcf 100644 --- a/actionview/test/template/template_error_test.rb +++ b/actionview/test/template/template_error_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class TemplateErrorTest < ActiveSupport::TestCase diff --git a/actionview/test/template/template_test.rb b/actionview/test/template/template_test.rb index 9d31a98703..0420b2df1d 100644 --- a/actionview/test/template/template_test.rb +++ b/actionview/test/template/template_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # encoding: US-ASCII require "abstract_unit" require "logger" diff --git a/actionview/test/template/test_case_test.rb b/actionview/test/template/test_case_test.rb index 3deddd5706..4a8324b235 100644 --- a/actionview/test/template/test_case_test.rb +++ b/actionview/test/template/test_case_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "rails/engine" diff --git a/actionview/test/template/test_test.rb b/actionview/test/template/test_test.rb index 52cac77bc5..ecc7a9a5a1 100644 --- a/actionview/test/template/test_test.rb +++ b/actionview/test/template/test_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" module PeopleHelper diff --git a/actionview/test/template/testing/fixture_resolver_test.rb b/actionview/test/template/testing/fixture_resolver_test.rb index effe453fc0..45b4e1b309 100644 --- a/actionview/test/template/testing/fixture_resolver_test.rb +++ b/actionview/test/template/testing/fixture_resolver_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class FixtureResolverTest < ActiveSupport::TestCase diff --git a/actionview/test/template/testing/null_resolver_test.rb b/actionview/test/template/testing/null_resolver_test.rb index 5346fd3368..cc7a732d21 100644 --- a/actionview/test/template/testing/null_resolver_test.rb +++ b/actionview/test/template/testing/null_resolver_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class NullResolverTest < ActiveSupport::TestCase diff --git a/actionview/test/template/text_helper_test.rb b/actionview/test/template/text_helper_test.rb index 251c98230f..52f20b631b 100644 --- a/actionview/test/template/text_helper_test.rb +++ b/actionview/test/template/text_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class TextHelperTest < ActionView::TestCase diff --git a/actionview/test/template/text_test.rb b/actionview/test/template/text_test.rb index 72ffd5f3be..4eb571eaa7 100644 --- a/actionview/test/template/text_test.rb +++ b/actionview/test/template/text_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class TextTest < ActiveSupport::TestCase diff --git a/actionview/test/template/translation_helper_test.rb b/actionview/test/template/translation_helper_test.rb index 1cfc13f337..f43e8b9a80 100644 --- a/actionview/test/template/translation_helper_test.rb +++ b/actionview/test/template/translation_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" module I18n diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb index bdedbeba92..c5790d29b3 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class UrlHelperTest < ActiveSupport::TestCase diff --git a/actionview/test/ujs/config.ru b/actionview/test/ujs/config.ru index 213a41127a..87f37efe8b 100644 --- a/actionview/test/ujs/config.ru +++ b/actionview/test/ujs/config.ru @@ -1,3 +1,4 @@ +# frozen_string_literal: true $LOAD_PATH.unshift __dir__ require "server" diff --git a/actionview/test/ujs/server.rb b/actionview/test/ujs/server.rb index 7deb208af0..b31c6b896a 100644 --- a/actionview/test/ujs/server.rb +++ b/actionview/test/ujs/server.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rack" require "rails" require "action_controller/railtie" -- cgit v1.2.3 From c4d1a4efeec6f0b5b58222993aa0bec85a19b6a8 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 30 Jun 2017 14:13:53 +0900 Subject: [Action View] require => require_relative --- actionview/lib/action_view.rb | 2 +- actionview/lib/action_view/base.rb | 10 +++++----- actionview/lib/action_view/dependency_tracker.rb | 2 +- actionview/lib/action_view/digestor.rb | 2 +- actionview/lib/action_view/helpers/asset_tag_helper.rb | 4 ++-- actionview/lib/action_view/helpers/date_helper.rb | 2 +- actionview/lib/action_view/helpers/form_helper.rb | 12 ++++++------ actionview/lib/action_view/helpers/form_options_helper.rb | 2 +- actionview/lib/action_view/helpers/form_tag_helper.rb | 2 +- actionview/lib/action_view/helpers/javascript_helper.rb | 2 +- actionview/lib/action_view/helpers/tags/check_box.rb | 2 +- .../lib/action_view/helpers/tags/collection_check_boxes.rb | 2 +- .../lib/action_view/helpers/tags/collection_radio_buttons.rb | 2 +- actionview/lib/action_view/helpers/tags/radio_button.rb | 2 +- actionview/lib/action_view/helpers/tags/text_area.rb | 2 +- actionview/lib/action_view/helpers/tags/text_field.rb | 2 +- actionview/lib/action_view/helpers/translation_helper.rb | 2 +- actionview/lib/action_view/helpers/url_helper.rb | 2 +- actionview/lib/action_view/layouts.rb | 2 +- actionview/lib/action_view/lookup_context.rb | 2 +- actionview/lib/action_view/record_identifier.rb | 2 +- actionview/lib/action_view/renderer/partial_renderer.rb | 2 +- actionview/lib/action_view/rendering.rb | 2 +- actionview/lib/action_view/template/resolver.rb | 2 +- actionview/lib/action_view/testing/resolvers.rb | 2 +- 25 files changed, 35 insertions(+), 35 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view.rb b/actionview/lib/action_view.rb index 99c5b831b5..53a83d48f6 100644 --- a/actionview/lib/action_view.rb +++ b/actionview/lib/action_view.rb @@ -23,7 +23,7 @@ require "active_support" require "active_support/rails" -require "action_view/version" +require_relative "action_view/version" module ActionView extend ActiveSupport::Autoload diff --git a/actionview/lib/action_view/base.rb b/actionview/lib/action_view/base.rb index 1808553239..969d300bc1 100644 --- a/actionview/lib/action_view/base.rb +++ b/actionview/lib/action_view/base.rb @@ -1,11 +1,11 @@ require "active_support/core_ext/module/attr_internal" require "active_support/core_ext/module/attribute_accessors" require "active_support/ordered_options" -require "action_view/log_subscriber" -require "action_view/helpers" -require "action_view/context" -require "action_view/template" -require "action_view/lookup_context" +require_relative "log_subscriber" +require_relative "helpers" +require_relative "context" +require_relative "template" +require_relative "lookup_context" module ActionView #:nodoc: # = Action View Base diff --git a/actionview/lib/action_view/dependency_tracker.rb b/actionview/lib/action_view/dependency_tracker.rb index 451eeec9d6..ee438f9311 100644 --- a/actionview/lib/action_view/dependency_tracker.rb +++ b/actionview/lib/action_view/dependency_tracker.rb @@ -1,5 +1,5 @@ require "concurrent/map" -require "action_view/path_set" +require_relative "path_set" module ActionView class DependencyTracker # :nodoc: diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb index 5ddf1ceb66..00ff36c879 100644 --- a/actionview/lib/action_view/digestor.rb +++ b/actionview/lib/action_view/digestor.rb @@ -1,5 +1,5 @@ require "concurrent/map" -require "action_view/dependency_tracker" +require_relative "dependency_tracker" require "monitor" module ActionView diff --git a/actionview/lib/action_view/helpers/asset_tag_helper.rb b/actionview/lib/action_view/helpers/asset_tag_helper.rb index c21fe782c6..d4db2abbe1 100644 --- a/actionview/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionview/lib/action_view/helpers/asset_tag_helper.rb @@ -1,7 +1,7 @@ require "active_support/core_ext/array/extract_options" require "active_support/core_ext/hash/keys" -require "action_view/helpers/asset_url_helper" -require "action_view/helpers/tag_helper" +require_relative "asset_url_helper" +require_relative "tag_helper" module ActionView # = Action View Asset Tag Helpers diff --git a/actionview/lib/action_view/helpers/date_helper.rb b/actionview/lib/action_view/helpers/date_helper.rb index 3f43465aa4..80ca3f076c 100644 --- a/actionview/lib/action_view/helpers/date_helper.rb +++ b/actionview/lib/action_view/helpers/date_helper.rb @@ -1,5 +1,5 @@ require "date" -require "action_view/helpers/tag_helper" +require_relative "tag_helper" require "active_support/core_ext/array/extract_options" require "active_support/core_ext/date/conversions" require "active_support/core_ext/hash/slice" diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index 4b2561e53d..6b36c2272a 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -1,10 +1,10 @@ require "cgi" -require "action_view/helpers/date_helper" -require "action_view/helpers/tag_helper" -require "action_view/helpers/form_tag_helper" -require "action_view/helpers/active_model_helper" -require "action_view/model_naming" -require "action_view/record_identifier" +require_relative "date_helper" +require_relative "tag_helper" +require_relative "form_tag_helper" +require_relative "active_model_helper" +require_relative "../model_naming" +require_relative "../record_identifier" require "active_support/core_ext/module/attribute_accessors" require "active_support/core_ext/hash/slice" require "active_support/core_ext/string/output_safety" diff --git a/actionview/lib/action_view/helpers/form_options_helper.rb b/actionview/lib/action_view/helpers/form_options_helper.rb index 07d4310a4e..0de3800a51 100644 --- a/actionview/lib/action_view/helpers/form_options_helper.rb +++ b/actionview/lib/action_view/helpers/form_options_helper.rb @@ -1,6 +1,6 @@ require "cgi" require "erb" -require "action_view/helpers/form_helper" +require_relative "form_helper" require "active_support/core_ext/string/output_safety" require "active_support/core_ext/array/extract_options" require "active_support/core_ext/array/wrap" diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 9fc08b3837..c8c6632781 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -1,5 +1,5 @@ require "cgi" -require "action_view/helpers/tag_helper" +require_relative "tag_helper" require "active_support/core_ext/string/output_safety" require "active_support/core_ext/module/attribute_accessors" diff --git a/actionview/lib/action_view/helpers/javascript_helper.rb b/actionview/lib/action_view/helpers/javascript_helper.rb index 22e1e74ad6..ea0b877de5 100644 --- a/actionview/lib/action_view/helpers/javascript_helper.rb +++ b/actionview/lib/action_view/helpers/javascript_helper.rb @@ -1,4 +1,4 @@ -require "action_view/helpers/tag_helper" +require_relative "tag_helper" module ActionView module Helpers diff --git a/actionview/lib/action_view/helpers/tags/check_box.rb b/actionview/lib/action_view/helpers/tags/check_box.rb index 02f87fc89f..b9b988325d 100644 --- a/actionview/lib/action_view/helpers/tags/check_box.rb +++ b/actionview/lib/action_view/helpers/tags/check_box.rb @@ -1,4 +1,4 @@ -require "action_view/helpers/tags/checkable" +require_relative "checkable" module ActionView module Helpers diff --git a/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb b/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb index e02b7bdb2e..ef37c1c342 100644 --- a/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb +++ b/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb @@ -1,4 +1,4 @@ -require "action_view/helpers/tags/collection_helpers" +require_relative "collection_helpers" module ActionView module Helpers diff --git a/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb b/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb index f085a5fb73..c7d28905d0 100644 --- a/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb +++ b/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb @@ -1,4 +1,4 @@ -require "action_view/helpers/tags/collection_helpers" +require_relative "collection_helpers" module ActionView module Helpers diff --git a/actionview/lib/action_view/helpers/tags/radio_button.rb b/actionview/lib/action_view/helpers/tags/radio_button.rb index 43dbd32083..782263ac5b 100644 --- a/actionview/lib/action_view/helpers/tags/radio_button.rb +++ b/actionview/lib/action_view/helpers/tags/radio_button.rb @@ -1,4 +1,4 @@ -require "action_view/helpers/tags/checkable" +require_relative "checkable" module ActionView module Helpers diff --git a/actionview/lib/action_view/helpers/tags/text_area.rb b/actionview/lib/action_view/helpers/tags/text_area.rb index 31e3a9e9b1..1058fdf55f 100644 --- a/actionview/lib/action_view/helpers/tags/text_area.rb +++ b/actionview/lib/action_view/helpers/tags/text_area.rb @@ -1,4 +1,4 @@ -require "action_view/helpers/tags/placeholderable" +require_relative "placeholderable" module ActionView module Helpers diff --git a/actionview/lib/action_view/helpers/tags/text_field.rb b/actionview/lib/action_view/helpers/tags/text_field.rb index 613cade7b3..1d55105587 100644 --- a/actionview/lib/action_view/helpers/tags/text_field.rb +++ b/actionview/lib/action_view/helpers/tags/text_field.rb @@ -1,4 +1,4 @@ -require "action_view/helpers/tags/placeholderable" +require_relative "placeholderable" module ActionView module Helpers diff --git a/actionview/lib/action_view/helpers/translation_helper.rb b/actionview/lib/action_view/helpers/translation_helper.rb index cc928f2b7a..f670d9956c 100644 --- a/actionview/lib/action_view/helpers/translation_helper.rb +++ b/actionview/lib/action_view/helpers/translation_helper.rb @@ -1,4 +1,4 @@ -require "action_view/helpers/tag_helper" +require_relative "tag_helper" require "active_support/core_ext/string/access" require "i18n/exceptions" diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb index b78c367921..644e1e4391 100644 --- a/actionview/lib/action_view/helpers/url_helper.rb +++ b/actionview/lib/action_view/helpers/url_helper.rb @@ -1,4 +1,4 @@ -require "action_view/helpers/javascript_helper" +require_relative "javascript_helper" require "active_support/core_ext/array/access" require "active_support/core_ext/hash/keys" require "active_support/core_ext/string/output_safety" diff --git a/actionview/lib/action_view/layouts.rb b/actionview/lib/action_view/layouts.rb index ab8409e8d0..b62fde30e8 100644 --- a/actionview/lib/action_view/layouts.rb +++ b/actionview/lib/action_view/layouts.rb @@ -1,4 +1,4 @@ -require "action_view/rendering" +require_relative "rendering" require "active_support/core_ext/module/remove_method" module ActionView diff --git a/actionview/lib/action_view/lookup_context.rb b/actionview/lib/action_view/lookup_context.rb index b7dbb38369..ce5493c01b 100644 --- a/actionview/lib/action_view/lookup_context.rb +++ b/actionview/lib/action_view/lookup_context.rb @@ -1,7 +1,7 @@ require "concurrent/map" require "active_support/core_ext/module/remove_method" require "active_support/core_ext/module/attribute_accessors" -require "action_view/template/resolver" +require_relative "template/resolver" module ActionView # = Action View Lookup Context diff --git a/actionview/lib/action_view/record_identifier.rb b/actionview/lib/action_view/record_identifier.rb index 48bea315a9..6805513347 100644 --- a/actionview/lib/action_view/record_identifier.rb +++ b/actionview/lib/action_view/record_identifier.rb @@ -1,5 +1,5 @@ require "active_support/core_ext/module" -require "action_view/model_naming" +require_relative "model_naming" module ActionView # RecordIdentifier encapsulates methods used by various ActionView helpers diff --git a/actionview/lib/action_view/renderer/partial_renderer.rb b/actionview/lib/action_view/renderer/partial_renderer.rb index 1f8f997a2d..77f5084686 100644 --- a/actionview/lib/action_view/renderer/partial_renderer.rb +++ b/actionview/lib/action_view/renderer/partial_renderer.rb @@ -1,5 +1,5 @@ require "concurrent/map" -require "action_view/renderer/partial_renderer/collection_caching" +require_relative "partial_renderer/collection_caching" module ActionView class PartialIteration diff --git a/actionview/lib/action_view/rendering.rb b/actionview/lib/action_view/rendering.rb index cf18562c45..9bee76a1f7 100644 --- a/actionview/lib/action_view/rendering.rb +++ b/actionview/lib/action_view/rendering.rb @@ -1,4 +1,4 @@ -require "action_view/view_paths" +require_relative "view_paths" module ActionView # This is a class to fix I18n global state. Whenever you provide I18n.locale during a request, diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb index 75ea4d31f5..df2cd568a2 100644 --- a/actionview/lib/action_view/template/resolver.rb +++ b/actionview/lib/action_view/template/resolver.rb @@ -1,7 +1,7 @@ require "pathname" require "active_support/core_ext/class" require "active_support/core_ext/module/attribute_accessors" -require "action_view/template" +require_relative "../template" require "thread" require "concurrent/map" diff --git a/actionview/lib/action_view/testing/resolvers.rb b/actionview/lib/action_view/testing/resolvers.rb index 3188526b63..f00847b64d 100644 --- a/actionview/lib/action_view/testing/resolvers.rb +++ b/actionview/lib/action_view/testing/resolvers.rb @@ -1,4 +1,4 @@ -require "action_view/template/resolver" +require_relative "../template/resolver" module ActionView #:nodoc: # Use FixtureResolver in your tests to simulate the presence of files on the -- cgit v1.2.3 From 87b3e226d65ac1ed371620bfdcd2f950c87cfece Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sun, 2 Jul 2017 02:15:17 +0930 Subject: Revert "Merge pull request #29540 from kirs/rubocop-frozen-string" This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa. --- actionview/Rakefile | 1 - actionview/actionview.gemspec | 1 - actionview/bin/test | 1 - actionview/lib/action_view.rb | 1 - actionview/lib/action_view/base.rb | 1 - actionview/lib/action_view/buffers.rb | 1 - actionview/lib/action_view/context.rb | 1 - actionview/lib/action_view/dependency_tracker.rb | 1 - actionview/lib/action_view/digestor.rb | 1 - actionview/lib/action_view/flows.rb | 1 - actionview/lib/action_view/gem_version.rb | 1 - actionview/lib/action_view/helpers.rb | 1 - actionview/lib/action_view/helpers/active_model_helper.rb | 1 - actionview/lib/action_view/helpers/asset_tag_helper.rb | 1 - actionview/lib/action_view/helpers/asset_url_helper.rb | 1 - actionview/lib/action_view/helpers/atom_feed_helper.rb | 1 - actionview/lib/action_view/helpers/cache_helper.rb | 1 - actionview/lib/action_view/helpers/capture_helper.rb | 1 - actionview/lib/action_view/helpers/controller_helper.rb | 1 - actionview/lib/action_view/helpers/csrf_helper.rb | 1 - actionview/lib/action_view/helpers/date_helper.rb | 1 - actionview/lib/action_view/helpers/debug_helper.rb | 1 - actionview/lib/action_view/helpers/form_helper.rb | 1 - actionview/lib/action_view/helpers/form_options_helper.rb | 1 - actionview/lib/action_view/helpers/form_tag_helper.rb | 1 - actionview/lib/action_view/helpers/javascript_helper.rb | 1 - actionview/lib/action_view/helpers/number_helper.rb | 1 - actionview/lib/action_view/helpers/output_safety_helper.rb | 1 - actionview/lib/action_view/helpers/record_tag_helper.rb | 1 - actionview/lib/action_view/helpers/rendering_helper.rb | 1 - actionview/lib/action_view/helpers/sanitize_helper.rb | 1 - actionview/lib/action_view/helpers/tag_helper.rb | 2 +- actionview/lib/action_view/helpers/tags.rb | 1 - actionview/lib/action_view/helpers/tags/base.rb | 1 - actionview/lib/action_view/helpers/tags/check_box.rb | 1 - actionview/lib/action_view/helpers/tags/checkable.rb | 1 - actionview/lib/action_view/helpers/tags/collection_check_boxes.rb | 1 - actionview/lib/action_view/helpers/tags/collection_helpers.rb | 1 - actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb | 1 - actionview/lib/action_view/helpers/tags/collection_select.rb | 1 - actionview/lib/action_view/helpers/tags/color_field.rb | 1 - actionview/lib/action_view/helpers/tags/date_field.rb | 1 - actionview/lib/action_view/helpers/tags/date_select.rb | 1 - actionview/lib/action_view/helpers/tags/datetime_field.rb | 1 - actionview/lib/action_view/helpers/tags/datetime_local_field.rb | 1 - actionview/lib/action_view/helpers/tags/datetime_select.rb | 1 - actionview/lib/action_view/helpers/tags/email_field.rb | 1 - actionview/lib/action_view/helpers/tags/file_field.rb | 1 - actionview/lib/action_view/helpers/tags/grouped_collection_select.rb | 1 - actionview/lib/action_view/helpers/tags/hidden_field.rb | 1 - actionview/lib/action_view/helpers/tags/label.rb | 1 - actionview/lib/action_view/helpers/tags/month_field.rb | 1 - actionview/lib/action_view/helpers/tags/number_field.rb | 1 - actionview/lib/action_view/helpers/tags/password_field.rb | 1 - actionview/lib/action_view/helpers/tags/placeholderable.rb | 1 - actionview/lib/action_view/helpers/tags/radio_button.rb | 1 - actionview/lib/action_view/helpers/tags/range_field.rb | 1 - actionview/lib/action_view/helpers/tags/search_field.rb | 1 - actionview/lib/action_view/helpers/tags/select.rb | 1 - actionview/lib/action_view/helpers/tags/tel_field.rb | 1 - actionview/lib/action_view/helpers/tags/text_area.rb | 1 - actionview/lib/action_view/helpers/tags/text_field.rb | 1 - actionview/lib/action_view/helpers/tags/time_field.rb | 1 - actionview/lib/action_view/helpers/tags/time_select.rb | 1 - actionview/lib/action_view/helpers/tags/time_zone_select.rb | 1 - actionview/lib/action_view/helpers/tags/translator.rb | 1 - actionview/lib/action_view/helpers/tags/url_field.rb | 1 - actionview/lib/action_view/helpers/tags/week_field.rb | 1 - actionview/lib/action_view/helpers/text_helper.rb | 1 - actionview/lib/action_view/helpers/translation_helper.rb | 1 - actionview/lib/action_view/helpers/url_helper.rb | 1 - actionview/lib/action_view/layouts.rb | 1 - actionview/lib/action_view/log_subscriber.rb | 1 - actionview/lib/action_view/lookup_context.rb | 1 - actionview/lib/action_view/model_naming.rb | 1 - actionview/lib/action_view/path_set.rb | 1 - actionview/lib/action_view/railtie.rb | 1 - actionview/lib/action_view/record_identifier.rb | 1 - actionview/lib/action_view/renderer/abstract_renderer.rb | 1 - actionview/lib/action_view/renderer/partial_renderer.rb | 1 - .../lib/action_view/renderer/partial_renderer/collection_caching.rb | 1 - actionview/lib/action_view/renderer/renderer.rb | 1 - actionview/lib/action_view/renderer/streaming_template_renderer.rb | 1 - actionview/lib/action_view/renderer/template_renderer.rb | 1 - actionview/lib/action_view/rendering.rb | 1 - actionview/lib/action_view/routing_url_for.rb | 1 - actionview/lib/action_view/tasks/cache_digests.rake | 1 - actionview/lib/action_view/template.rb | 1 - actionview/lib/action_view/template/error.rb | 1 - actionview/lib/action_view/template/handlers.rb | 1 - actionview/lib/action_view/template/handlers/builder.rb | 1 - actionview/lib/action_view/template/handlers/erb.rb | 1 - actionview/lib/action_view/template/handlers/erb/deprecated_erubis.rb | 1 - actionview/lib/action_view/template/handlers/erb/erubi.rb | 1 - actionview/lib/action_view/template/handlers/erb/erubis.rb | 1 - actionview/lib/action_view/template/handlers/html.rb | 1 - actionview/lib/action_view/template/handlers/raw.rb | 1 - actionview/lib/action_view/template/html.rb | 1 - actionview/lib/action_view/template/resolver.rb | 1 - actionview/lib/action_view/template/text.rb | 1 - actionview/lib/action_view/template/types.rb | 1 - actionview/lib/action_view/test_case.rb | 1 - actionview/lib/action_view/testing/resolvers.rb | 1 - actionview/lib/action_view/version.rb | 1 - actionview/lib/action_view/view_paths.rb | 1 - actionview/test/abstract_unit.rb | 1 - actionview/test/actionpack/abstract/abstract_controller_test.rb | 1 - actionview/test/actionpack/abstract/helper_test.rb | 1 - actionview/test/actionpack/abstract/layouts_test.rb | 1 - actionview/test/actionpack/abstract/render_test.rb | 1 - actionview/test/actionpack/controller/capture_test.rb | 1 - actionview/test/actionpack/controller/layout_test.rb | 1 - actionview/test/actionpack/controller/render_test.rb | 1 - actionview/test/actionpack/controller/view_paths_test.rb | 1 - actionview/test/active_record_unit.rb | 1 - actionview/test/activerecord/controller_runtime_test.rb | 1 - actionview/test/activerecord/debug_helper_test.rb | 1 - actionview/test/activerecord/form_helper_activerecord_test.rb | 1 - actionview/test/activerecord/polymorphic_routes_test.rb | 1 - actionview/test/activerecord/relation_cache_test.rb | 1 - .../test/activerecord/render_partial_with_record_identification_test.rb | 1 - actionview/test/fixtures/actionpack/layouts/builder.builder | 1 - actionview/test/fixtures/actionpack/test/_hello.builder | 1 - actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder | 1 - actionview/test/fixtures/actionpack/test/hello.builder | 1 - actionview/test/fixtures/actionpack/test/hello_world_container.builder | 1 - actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder | 1 - actionview/test/fixtures/actionpack/test/hello_xml_world.builder | 1 - .../test/fixtures/actionpack/test/implicit_content_type.atom.builder | 1 - .../test/fixtures/actionpack/test/non_erb_block_content_for.builder | 1 - actionview/test/fixtures/comments/empty.html.builder | 1 - actionview/test/fixtures/company.rb | 1 - actionview/test/fixtures/developer.rb | 1 - actionview/test/fixtures/helpers/abc_helper.rb | 1 - actionview/test/fixtures/helpers/helpery_test_helper.rb | 1 - actionview/test/fixtures/helpers_missing/invalid_require_helper.rb | 1 - actionview/test/fixtures/mascot.rb | 1 - actionview/test/fixtures/project.rb | 1 - actionview/test/fixtures/reply.rb | 1 - actionview/test/fixtures/ruby_template.ruby | 1 - actionview/test/fixtures/test/hello.builder | 1 - actionview/test/fixtures/topic.rb | 1 - actionview/test/lib/controller/fake_models.rb | 1 - actionview/test/template/active_model_helper_test.rb | 1 - actionview/test/template/asset_tag_helper_test.rb | 1 - actionview/test/template/atom_feed_helper_test.rb | 1 - actionview/test/template/capture_helper_test.rb | 1 - actionview/test/template/compiled_templates_test.rb | 1 - actionview/test/template/controller_helper_test.rb | 1 - actionview/test/template/date_helper_i18n_test.rb | 1 - actionview/test/template/date_helper_test.rb | 1 - actionview/test/template/dependency_tracker_test.rb | 1 - actionview/test/template/digestor_test.rb | 1 - actionview/test/template/erb/deprecated_erubis_implementation_test.rb | 1 - actionview/test/template/erb/form_for_test.rb | 1 - actionview/test/template/erb/helper.rb | 1 - actionview/test/template/erb/tag_helper_test.rb | 1 - actionview/test/template/erb_util_test.rb | 1 - actionview/test/template/form_collections_helper_test.rb | 1 - actionview/test/template/form_helper/form_with_test.rb | 1 - actionview/test/template/form_helper_test.rb | 1 - actionview/test/template/form_options_helper_i18n_test.rb | 1 - actionview/test/template/form_options_helper_test.rb | 1 - actionview/test/template/form_tag_helper_test.rb | 1 - actionview/test/template/html_test.rb | 1 - actionview/test/template/javascript_helper_test.rb | 1 - actionview/test/template/log_subscriber_test.rb | 1 - actionview/test/template/lookup_context_test.rb | 1 - actionview/test/template/number_helper_test.rb | 1 - actionview/test/template/output_safety_helper_test.rb | 1 - actionview/test/template/partial_iteration_test.rb | 1 - actionview/test/template/record_identifier_test.rb | 1 - actionview/test/template/record_tag_helper_test.rb | 1 - actionview/test/template/render_test.rb | 1 - actionview/test/template/resolver_cache_test.rb | 1 - actionview/test/template/resolver_patterns_test.rb | 1 - actionview/test/template/sanitize_helper_test.rb | 1 - actionview/test/template/streaming_render_test.rb | 1 - actionview/test/template/tag_helper_test.rb | 1 - actionview/test/template/template_error_test.rb | 1 - actionview/test/template/template_test.rb | 1 - actionview/test/template/test_case_test.rb | 1 - actionview/test/template/test_test.rb | 1 - actionview/test/template/testing/fixture_resolver_test.rb | 1 - actionview/test/template/testing/null_resolver_test.rb | 1 - actionview/test/template/text_helper_test.rb | 1 - actionview/test/template/text_test.rb | 1 - actionview/test/template/translation_helper_test.rb | 1 - actionview/test/template/url_helper_test.rb | 1 - actionview/test/ujs/config.ru | 1 - actionview/test/ujs/server.rb | 1 - 191 files changed, 1 insertion(+), 191 deletions(-) (limited to 'actionview') diff --git a/actionview/Rakefile b/actionview/Rakefile index 564971ce14..0fc38e8db4 100644 --- a/actionview/Rakefile +++ b/actionview/Rakefile @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "rake/testtask" require "fileutils" require "open3" diff --git a/actionview/actionview.gemspec b/actionview/actionview.gemspec index 5455a37c5e..48e79c53ca 100644 --- a/actionview/actionview.gemspec +++ b/actionview/actionview.gemspec @@ -1,4 +1,3 @@ -# frozen_string_literal: true version = File.read(File.expand_path("../RAILS_VERSION", __dir__)).strip Gem::Specification.new do |s| diff --git a/actionview/bin/test b/actionview/bin/test index c53377cc97..470ce93f10 100755 --- a/actionview/bin/test +++ b/actionview/bin/test @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -# frozen_string_literal: true COMPONENT_ROOT = File.expand_path("..", __dir__) require_relative "../../tools/test" diff --git a/actionview/lib/action_view.rb b/actionview/lib/action_view.rb index c125651a64..99c5b831b5 100644 --- a/actionview/lib/action_view.rb +++ b/actionview/lib/action_view.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true #-- # Copyright (c) 2004-2017 David Heinemeier Hansson # diff --git a/actionview/lib/action_view/base.rb b/actionview/lib/action_view/base.rb index 51f8202de4..1808553239 100644 --- a/actionview/lib/action_view/base.rb +++ b/actionview/lib/action_view/base.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/module/attr_internal" require "active_support/core_ext/module/attribute_accessors" require "active_support/ordered_options" diff --git a/actionview/lib/action_view/buffers.rb b/actionview/lib/action_view/buffers.rb index 824995582b..089daa6d60 100644 --- a/actionview/lib/action_view/buffers.rb +++ b/actionview/lib/action_view/buffers.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/string/output_safety" module ActionView diff --git a/actionview/lib/action_view/context.rb b/actionview/lib/action_view/context.rb index 3a24a7692e..31aa73a0cf 100644 --- a/actionview/lib/action_view/context.rb +++ b/actionview/lib/action_view/context.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module CompiledTemplates #:nodoc: # holds compiled template code diff --git a/actionview/lib/action_view/dependency_tracker.rb b/actionview/lib/action_view/dependency_tracker.rb index 9128494501..451eeec9d6 100644 --- a/actionview/lib/action_view/dependency_tracker.rb +++ b/actionview/lib/action_view/dependency_tracker.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "concurrent/map" require "action_view/path_set" diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb index 9a5e11699c..5ddf1ceb66 100644 --- a/actionview/lib/action_view/digestor.rb +++ b/actionview/lib/action_view/digestor.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "concurrent/map" require "action_view/dependency_tracker" require "monitor" diff --git a/actionview/lib/action_view/flows.rb b/actionview/lib/action_view/flows.rb index d933f05456..6d5f57a570 100644 --- a/actionview/lib/action_view/flows.rb +++ b/actionview/lib/action_view/flows.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/string/output_safety" module ActionView diff --git a/actionview/lib/action_view/gem_version.rb b/actionview/lib/action_view/gem_version.rb index 44425b4aa3..92e21d7a4f 100644 --- a/actionview/lib/action_view/gem_version.rb +++ b/actionview/lib/action_view/gem_version.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView # Returns the version of the currently loaded Action View as a Gem::Version def self.gem_version diff --git a/actionview/lib/action_view/helpers.rb b/actionview/lib/action_view/helpers.rb index b98041252c..c1b4b4f84b 100644 --- a/actionview/lib/action_view/helpers.rb +++ b/actionview/lib/action_view/helpers.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/benchmarkable" module ActionView #:nodoc: diff --git a/actionview/lib/action_view/helpers/active_model_helper.rb b/actionview/lib/action_view/helpers/active_model_helper.rb index ba3b5801c9..4bb5788a16 100644 --- a/actionview/lib/action_view/helpers/active_model_helper.rb +++ b/actionview/lib/action_view/helpers/active_model_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/module/attribute_accessors" require "active_support/core_ext/enumerable" diff --git a/actionview/lib/action_view/helpers/asset_tag_helper.rb b/actionview/lib/action_view/helpers/asset_tag_helper.rb index cfb6579f67..3a854e82d3 100644 --- a/actionview/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionview/lib/action_view/helpers/asset_tag_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/array/extract_options" require "active_support/core_ext/hash/keys" require "action_view/helpers/asset_url_helper" diff --git a/actionview/lib/action_view/helpers/asset_url_helper.rb b/actionview/lib/action_view/helpers/asset_url_helper.rb index f9f12fdba5..03bd1eb008 100644 --- a/actionview/lib/action_view/helpers/asset_url_helper.rb +++ b/actionview/lib/action_view/helpers/asset_url_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "zlib" module ActionView diff --git a/actionview/lib/action_view/helpers/atom_feed_helper.rb b/actionview/lib/action_view/helpers/atom_feed_helper.rb index a4ec1f9388..3538515aee 100644 --- a/actionview/lib/action_view/helpers/atom_feed_helper.rb +++ b/actionview/lib/action_view/helpers/atom_feed_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "set" module ActionView diff --git a/actionview/lib/action_view/helpers/cache_helper.rb b/actionview/lib/action_view/helpers/cache_helper.rb index 101fe86e9f..b7c7324f31 100644 --- a/actionview/lib/action_view/helpers/cache_helper.rb +++ b/actionview/lib/action_view/helpers/cache_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView # = Action View Cache Helper module Helpers diff --git a/actionview/lib/action_view/helpers/capture_helper.rb b/actionview/lib/action_view/helpers/capture_helper.rb index 0865ac0a7e..719592b5c5 100644 --- a/actionview/lib/action_view/helpers/capture_helper.rb +++ b/actionview/lib/action_view/helpers/capture_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/string/output_safety" module ActionView diff --git a/actionview/lib/action_view/helpers/controller_helper.rb b/actionview/lib/action_view/helpers/controller_helper.rb index 0991fc16e0..e86cdca4e4 100644 --- a/actionview/lib/action_view/helpers/controller_helper.rb +++ b/actionview/lib/action_view/helpers/controller_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/module/attr_internal" module ActionView diff --git a/actionview/lib/action_view/helpers/csrf_helper.rb b/actionview/lib/action_view/helpers/csrf_helper.rb index f560445b83..2a15d2aa5a 100644 --- a/actionview/lib/action_view/helpers/csrf_helper.rb +++ b/actionview/lib/action_view/helpers/csrf_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView # = Action View CSRF Helper module Helpers diff --git a/actionview/lib/action_view/helpers/date_helper.rb b/actionview/lib/action_view/helpers/date_helper.rb index 552d9cfeab..d28eec88a1 100644 --- a/actionview/lib/action_view/helpers/date_helper.rb +++ b/actionview/lib/action_view/helpers/date_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "date" require "action_view/helpers/tag_helper" require "active_support/core_ext/array/extract_options" diff --git a/actionview/lib/action_view/helpers/debug_helper.rb b/actionview/lib/action_view/helpers/debug_helper.rb index 26c97ab2bf..f61ca2c9c2 100644 --- a/actionview/lib/action_view/helpers/debug_helper.rb +++ b/actionview/lib/action_view/helpers/debug_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView # = Action View Debug Helper # diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index 4a1e6ae9bd..4b2561e53d 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cgi" require "action_view/helpers/date_helper" require "action_view/helpers/tag_helper" diff --git a/actionview/lib/action_view/helpers/form_options_helper.rb b/actionview/lib/action_view/helpers/form_options_helper.rb index 7d0fbce34e..07d4310a4e 100644 --- a/actionview/lib/action_view/helpers/form_options_helper.rb +++ b/actionview/lib/action_view/helpers/form_options_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cgi" require "erb" require "action_view/helpers/form_helper" diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 8225fa1e38..9fc08b3837 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "cgi" require "action_view/helpers/tag_helper" require "active_support/core_ext/string/output_safety" diff --git a/actionview/lib/action_view/helpers/javascript_helper.rb b/actionview/lib/action_view/helpers/javascript_helper.rb index 6dfbdcac40..6ba70ec081 100644 --- a/actionview/lib/action_view/helpers/javascript_helper.rb +++ b/actionview/lib/action_view/helpers/javascript_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_view/helpers/tag_helper" module ActionView diff --git a/actionview/lib/action_view/helpers/number_helper.rb b/actionview/lib/action_view/helpers/number_helper.rb index e40041cb74..b6bc5f4f6f 100644 --- a/actionview/lib/action_view/helpers/number_helper.rb +++ b/actionview/lib/action_view/helpers/number_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/hash/keys" require "active_support/core_ext/string/output_safety" require "active_support/number_helper" diff --git a/actionview/lib/action_view/helpers/output_safety_helper.rb b/actionview/lib/action_view/helpers/output_safety_helper.rb index 71e5862698..25defd1276 100644 --- a/actionview/lib/action_view/helpers/output_safety_helper.rb +++ b/actionview/lib/action_view/helpers/output_safety_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/string/output_safety" module ActionView #:nodoc: diff --git a/actionview/lib/action_view/helpers/record_tag_helper.rb b/actionview/lib/action_view/helpers/record_tag_helper.rb index 7aca005d46..f7ee573035 100644 --- a/actionview/lib/action_view/helpers/record_tag_helper.rb +++ b/actionview/lib/action_view/helpers/record_tag_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module RecordTagHelper diff --git a/actionview/lib/action_view/helpers/rendering_helper.rb b/actionview/lib/action_view/helpers/rendering_helper.rb index ffb5627805..7d7f2393ff 100644 --- a/actionview/lib/action_view/helpers/rendering_helper.rb +++ b/actionview/lib/action_view/helpers/rendering_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers # = Action View Rendering diff --git a/actionview/lib/action_view/helpers/sanitize_helper.rb b/actionview/lib/action_view/helpers/sanitize_helper.rb index b7757086c3..0abd5bc5dc 100644 --- a/actionview/lib/action_view/helpers/sanitize_helper.rb +++ b/actionview/lib/action_view/helpers/sanitize_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/object/try" require "rails-html-sanitizer" diff --git a/actionview/lib/action_view/helpers/tag_helper.rb b/actionview/lib/action_view/helpers/tag_helper.rb index a64d7e396e..306b71c85e 100644 --- a/actionview/lib/action_view/helpers/tag_helper.rb +++ b/actionview/lib/action_view/helpers/tag_helper.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: true +# frozen-string-literal: true require "active_support/core_ext/string/output_safety" require "set" diff --git a/actionview/lib/action_view/helpers/tags.rb b/actionview/lib/action_view/helpers/tags.rb index ec06617891..a4f6eb0150 100644 --- a/actionview/lib/action_view/helpers/tags.rb +++ b/actionview/lib/action_view/helpers/tags.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags #:nodoc: diff --git a/actionview/lib/action_view/helpers/tags/base.rb b/actionview/lib/action_view/helpers/tags/base.rb index dec1c1f070..0895533a60 100644 --- a/actionview/lib/action_view/helpers/tags/base.rb +++ b/actionview/lib/action_view/helpers/tags/base.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/check_box.rb b/actionview/lib/action_view/helpers/tags/check_box.rb index 88da221eb2..02f87fc89f 100644 --- a/actionview/lib/action_view/helpers/tags/check_box.rb +++ b/actionview/lib/action_view/helpers/tags/check_box.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_view/helpers/tags/checkable" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/checkable.rb b/actionview/lib/action_view/helpers/tags/checkable.rb index a3638aa3fa..052e9df662 100644 --- a/actionview/lib/action_view/helpers/tags/checkable.rb +++ b/actionview/lib/action_view/helpers/tags/checkable.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb b/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb index 1e9f6a1cee..e02b7bdb2e 100644 --- a/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb +++ b/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_view/helpers/tags/collection_helpers" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/collection_helpers.rb b/actionview/lib/action_view/helpers/tags/collection_helpers.rb index 7f0296e466..75d237eb35 100644 --- a/actionview/lib/action_view/helpers/tags/collection_helpers.rb +++ b/actionview/lib/action_view/helpers/tags/collection_helpers.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb b/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb index 85648991d7..f085a5fb73 100644 --- a/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb +++ b/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_view/helpers/tags/collection_helpers" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/collection_select.rb b/actionview/lib/action_view/helpers/tags/collection_select.rb index c6a81cf795..4365c714eb 100644 --- a/actionview/lib/action_view/helpers/tags/collection_select.rb +++ b/actionview/lib/action_view/helpers/tags/collection_select.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/color_field.rb b/actionview/lib/action_view/helpers/tags/color_field.rb index c133fcab77..b4bbe92746 100644 --- a/actionview/lib/action_view/helpers/tags/color_field.rb +++ b/actionview/lib/action_view/helpers/tags/color_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/date_field.rb b/actionview/lib/action_view/helpers/tags/date_field.rb index 2043a05689..c22be0db29 100644 --- a/actionview/lib/action_view/helpers/tags/date_field.rb +++ b/actionview/lib/action_view/helpers/tags/date_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/date_select.rb b/actionview/lib/action_view/helpers/tags/date_select.rb index fdfcad7e48..638c134deb 100644 --- a/actionview/lib/action_view/helpers/tags/date_select.rb +++ b/actionview/lib/action_view/helpers/tags/date_select.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/time/calculations" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/datetime_field.rb b/actionview/lib/action_view/helpers/tags/datetime_field.rb index 4686606806..b3940c7e44 100644 --- a/actionview/lib/action_view/helpers/tags/datetime_field.rb +++ b/actionview/lib/action_view/helpers/tags/datetime_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/datetime_local_field.rb b/actionview/lib/action_view/helpers/tags/datetime_local_field.rb index ba0c7fa5f7..b4a74185d1 100644 --- a/actionview/lib/action_view/helpers/tags/datetime_local_field.rb +++ b/actionview/lib/action_view/helpers/tags/datetime_local_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/datetime_select.rb b/actionview/lib/action_view/helpers/tags/datetime_select.rb index 3a36e47714..563de1840e 100644 --- a/actionview/lib/action_view/helpers/tags/datetime_select.rb +++ b/actionview/lib/action_view/helpers/tags/datetime_select.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/email_field.rb b/actionview/lib/action_view/helpers/tags/email_field.rb index 4ba0905cfb..7ce3ccb9bf 100644 --- a/actionview/lib/action_view/helpers/tags/email_field.rb +++ b/actionview/lib/action_view/helpers/tags/email_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/file_field.rb b/actionview/lib/action_view/helpers/tags/file_field.rb index 201b7fffa5..476b820d84 100644 --- a/actionview/lib/action_view/helpers/tags/file_field.rb +++ b/actionview/lib/action_view/helpers/tags/file_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/grouped_collection_select.rb b/actionview/lib/action_view/helpers/tags/grouped_collection_select.rb index 1b3f993b32..20e312dd0f 100644 --- a/actionview/lib/action_view/helpers/tags/grouped_collection_select.rb +++ b/actionview/lib/action_view/helpers/tags/grouped_collection_select.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/hidden_field.rb b/actionview/lib/action_view/helpers/tags/hidden_field.rb index ca5cd395a2..c3757c2461 100644 --- a/actionview/lib/action_view/helpers/tags/hidden_field.rb +++ b/actionview/lib/action_view/helpers/tags/hidden_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/label.rb b/actionview/lib/action_view/helpers/tags/label.rb index 9f8dac4bbd..cab15ae201 100644 --- a/actionview/lib/action_view/helpers/tags/label.rb +++ b/actionview/lib/action_view/helpers/tags/label.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/month_field.rb b/actionview/lib/action_view/helpers/tags/month_field.rb index ed74ca3f35..4c0fb846ee 100644 --- a/actionview/lib/action_view/helpers/tags/month_field.rb +++ b/actionview/lib/action_view/helpers/tags/month_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/number_field.rb b/actionview/lib/action_view/helpers/tags/number_field.rb index fc5adfeab1..4f95b1b4de 100644 --- a/actionview/lib/action_view/helpers/tags/number_field.rb +++ b/actionview/lib/action_view/helpers/tags/number_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/password_field.rb b/actionview/lib/action_view/helpers/tags/password_field.rb index 008df0f817..444ef65074 100644 --- a/actionview/lib/action_view/helpers/tags/password_field.rb +++ b/actionview/lib/action_view/helpers/tags/password_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/placeholderable.rb b/actionview/lib/action_view/helpers/tags/placeholderable.rb index 5ae57cdeef..cf7b117614 100644 --- a/actionview/lib/action_view/helpers/tags/placeholderable.rb +++ b/actionview/lib/action_view/helpers/tags/placeholderable.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/radio_button.rb b/actionview/lib/action_view/helpers/tags/radio_button.rb index 538826f749..43dbd32083 100644 --- a/actionview/lib/action_view/helpers/tags/radio_button.rb +++ b/actionview/lib/action_view/helpers/tags/radio_button.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_view/helpers/tags/checkable" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/range_field.rb b/actionview/lib/action_view/helpers/tags/range_field.rb index d7c11cc7a4..f98ae88043 100644 --- a/actionview/lib/action_view/helpers/tags/range_field.rb +++ b/actionview/lib/action_view/helpers/tags/range_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/search_field.rb b/actionview/lib/action_view/helpers/tags/search_field.rb index 38304d8d73..a848aeabfa 100644 --- a/actionview/lib/action_view/helpers/tags/search_field.rb +++ b/actionview/lib/action_view/helpers/tags/search_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/select.rb b/actionview/lib/action_view/helpers/tags/select.rb index 8c166d630f..380f7a8c4e 100644 --- a/actionview/lib/action_view/helpers/tags/select.rb +++ b/actionview/lib/action_view/helpers/tags/select.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/tel_field.rb b/actionview/lib/action_view/helpers/tags/tel_field.rb index c95127a714..987bb9e67a 100644 --- a/actionview/lib/action_view/helpers/tags/tel_field.rb +++ b/actionview/lib/action_view/helpers/tags/tel_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/text_area.rb b/actionview/lib/action_view/helpers/tags/text_area.rb index 6bf3c0c02f..31e3a9e9b1 100644 --- a/actionview/lib/action_view/helpers/tags/text_area.rb +++ b/actionview/lib/action_view/helpers/tags/text_area.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_view/helpers/tags/placeholderable" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/text_field.rb b/actionview/lib/action_view/helpers/tags/text_field.rb index 48930770be..613cade7b3 100644 --- a/actionview/lib/action_view/helpers/tags/text_field.rb +++ b/actionview/lib/action_view/helpers/tags/text_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_view/helpers/tags/placeholderable" module ActionView diff --git a/actionview/lib/action_view/helpers/tags/time_field.rb b/actionview/lib/action_view/helpers/tags/time_field.rb index 8c3f082359..0e90a3aed7 100644 --- a/actionview/lib/action_view/helpers/tags/time_field.rb +++ b/actionview/lib/action_view/helpers/tags/time_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/time_select.rb b/actionview/lib/action_view/helpers/tags/time_select.rb index d46728698f..0b06311d25 100644 --- a/actionview/lib/action_view/helpers/tags/time_select.rb +++ b/actionview/lib/action_view/helpers/tags/time_select.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/time_zone_select.rb b/actionview/lib/action_view/helpers/tags/time_zone_select.rb index 49e099d38a..80d165ec7e 100644 --- a/actionview/lib/action_view/helpers/tags/time_zone_select.rb +++ b/actionview/lib/action_view/helpers/tags/time_zone_select.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/translator.rb b/actionview/lib/action_view/helpers/tags/translator.rb index 0d3ac24689..ced835eaa8 100644 --- a/actionview/lib/action_view/helpers/tags/translator.rb +++ b/actionview/lib/action_view/helpers/tags/translator.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/url_field.rb b/actionview/lib/action_view/helpers/tags/url_field.rb index 4c474a579f..d76340178d 100644 --- a/actionview/lib/action_view/helpers/tags/url_field.rb +++ b/actionview/lib/action_view/helpers/tags/url_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/tags/week_field.rb b/actionview/lib/action_view/helpers/tags/week_field.rb index 08c6fbb81d..835d1667d7 100644 --- a/actionview/lib/action_view/helpers/tags/week_field.rb +++ b/actionview/lib/action_view/helpers/tags/week_field.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Helpers module Tags # :nodoc: diff --git a/actionview/lib/action_view/helpers/text_helper.rb b/actionview/lib/action_view/helpers/text_helper.rb index 4fce229276..bc922f9ce8 100644 --- a/actionview/lib/action_view/helpers/text_helper.rb +++ b/actionview/lib/action_view/helpers/text_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/string/filters" require "active_support/core_ext/array/extract_options" diff --git a/actionview/lib/action_view/helpers/translation_helper.rb b/actionview/lib/action_view/helpers/translation_helper.rb index a28acdf1f6..24d1f34c5a 100644 --- a/actionview/lib/action_view/helpers/translation_helper.rb +++ b/actionview/lib/action_view/helpers/translation_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_view/helpers/tag_helper" require "active_support/core_ext/string/access" require "i18n/exceptions" diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb index 6bdb8e90ff..b78c367921 100644 --- a/actionview/lib/action_view/helpers/url_helper.rb +++ b/actionview/lib/action_view/helpers/url_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_view/helpers/javascript_helper" require "active_support/core_ext/array/access" require "active_support/core_ext/hash/keys" diff --git a/actionview/lib/action_view/layouts.rb b/actionview/lib/action_view/layouts.rb index f5681668e5..ab8409e8d0 100644 --- a/actionview/lib/action_view/layouts.rb +++ b/actionview/lib/action_view/layouts.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_view/rendering" require "active_support/core_ext/module/remove_method" diff --git a/actionview/lib/action_view/log_subscriber.rb b/actionview/lib/action_view/log_subscriber.rb index deacf2d001..613be2b877 100644 --- a/actionview/lib/action_view/log_subscriber.rb +++ b/actionview/lib/action_view/log_subscriber.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/log_subscriber" module ActionView diff --git a/actionview/lib/action_view/lookup_context.rb b/actionview/lib/action_view/lookup_context.rb index 0220ac3a42..b7dbb38369 100644 --- a/actionview/lib/action_view/lookup_context.rb +++ b/actionview/lib/action_view/lookup_context.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "concurrent/map" require "active_support/core_ext/module/remove_method" require "active_support/core_ext/module/attribute_accessors" diff --git a/actionview/lib/action_view/model_naming.rb b/actionview/lib/action_view/model_naming.rb index 5eab00cd1a..b6ed13424e 100644 --- a/actionview/lib/action_view/model_naming.rb +++ b/actionview/lib/action_view/model_naming.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module ModelNaming #:nodoc: # Converts the given object to an ActiveModel compliant one. diff --git a/actionview/lib/action_view/path_set.rb b/actionview/lib/action_view/path_set.rb index 0ac5778273..6688519ffd 100644 --- a/actionview/lib/action_view/path_set.rb +++ b/actionview/lib/action_view/path_set.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView #:nodoc: # = Action View PathSet # diff --git a/actionview/lib/action_view/railtie.rb b/actionview/lib/action_view/railtie.rb index 3971dc0aed..61678933e9 100644 --- a/actionview/lib/action_view/railtie.rb +++ b/actionview/lib/action_view/railtie.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_view" require "rails" diff --git a/actionview/lib/action_view/record_identifier.rb b/actionview/lib/action_view/record_identifier.rb index 885f935248..48bea315a9 100644 --- a/actionview/lib/action_view/record_identifier.rb +++ b/actionview/lib/action_view/record_identifier.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/module" require "action_view/model_naming" diff --git a/actionview/lib/action_view/renderer/abstract_renderer.rb b/actionview/lib/action_view/renderer/abstract_renderer.rb index 217b05b5f3..0b315eb569 100644 --- a/actionview/lib/action_view/renderer/abstract_renderer.rb +++ b/actionview/lib/action_view/renderer/abstract_renderer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView # This class defines the interface for a renderer. Each class that # subclasses +AbstractRenderer+ is used by the base +Renderer+ class to diff --git a/actionview/lib/action_view/renderer/partial_renderer.rb b/actionview/lib/action_view/renderer/partial_renderer.rb index 0bc414677f..1f8f997a2d 100644 --- a/actionview/lib/action_view/renderer/partial_renderer.rb +++ b/actionview/lib/action_view/renderer/partial_renderer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "concurrent/map" require "action_view/renderer/partial_renderer/collection_caching" diff --git a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb index 61cb6c90b9..32663fb80d 100644 --- a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb +++ b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module CollectionCaching # :nodoc: extend ActiveSupport::Concern diff --git a/actionview/lib/action_view/renderer/renderer.rb b/actionview/lib/action_view/renderer/renderer.rb index 07461d3e2e..bcdeb85d30 100644 --- a/actionview/lib/action_view/renderer/renderer.rb +++ b/actionview/lib/action_view/renderer/renderer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView # This is the main entry point for rendering. It basically delegates # to other objects like TemplateRenderer and PartialRenderer which diff --git a/actionview/lib/action_view/renderer/streaming_template_renderer.rb b/actionview/lib/action_view/renderer/streaming_template_renderer.rb index 40d7ce63a6..62ce985243 100644 --- a/actionview/lib/action_view/renderer/streaming_template_renderer.rb +++ b/actionview/lib/action_view/renderer/streaming_template_renderer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "fiber" module ActionView diff --git a/actionview/lib/action_view/renderer/template_renderer.rb b/actionview/lib/action_view/renderer/template_renderer.rb index 1fe95a5f67..54317199de 100644 --- a/actionview/lib/action_view/renderer/template_renderer.rb +++ b/actionview/lib/action_view/renderer/template_renderer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/object/try" module ActionView diff --git a/actionview/lib/action_view/rendering.rb b/actionview/lib/action_view/rendering.rb index 29cdbf37cb..cf18562c45 100644 --- a/actionview/lib/action_view/rendering.rb +++ b/actionview/lib/action_view/rendering.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_view/view_paths" module ActionView diff --git a/actionview/lib/action_view/routing_url_for.rb b/actionview/lib/action_view/routing_url_for.rb index 3f6b59cf98..687ba7c1b4 100644 --- a/actionview/lib/action_view/routing_url_for.rb +++ b/actionview/lib/action_view/routing_url_for.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_dispatch/routing/polymorphic_routes" module ActionView diff --git a/actionview/lib/action_view/tasks/cache_digests.rake b/actionview/lib/action_view/tasks/cache_digests.rake index 929bace6d4..d30b3f7797 100644 --- a/actionview/lib/action_view/tasks/cache_digests.rake +++ b/actionview/lib/action_view/tasks/cache_digests.rake @@ -1,4 +1,3 @@ -# frozen_string_literal: true namespace :cache_digests do desc "Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)" task nested_dependencies: :environment do diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index 80b294dc3d..3f2546664e 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/object/try" require "active_support/core_ext/kernel/singleton_class" require "thread" diff --git a/actionview/lib/action_view/template/error.rb b/actionview/lib/action_view/template/error.rb index c2f13eb77c..cc90477190 100644 --- a/actionview/lib/action_view/template/error.rb +++ b/actionview/lib/action_view/template/error.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/enumerable" module ActionView diff --git a/actionview/lib/action_view/template/handlers.rb b/actionview/lib/action_view/template/handlers.rb index d5300ea659..f4301f6f07 100644 --- a/actionview/lib/action_view/template/handlers.rb +++ b/actionview/lib/action_view/template/handlers.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView #:nodoc: # = Action View Template Handlers class Template diff --git a/actionview/lib/action_view/template/handlers/builder.rb b/actionview/lib/action_view/template/handlers/builder.rb index f8f5b96704..67ad78133d 100644 --- a/actionview/lib/action_view/template/handlers/builder.rb +++ b/actionview/lib/action_view/template/handlers/builder.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Template::Handlers class Builder diff --git a/actionview/lib/action_view/template/handlers/erb.rb b/actionview/lib/action_view/template/handlers/erb.rb index fc2a901fa9..48c2e22a89 100644 --- a/actionview/lib/action_view/template/handlers/erb.rb +++ b/actionview/lib/action_view/template/handlers/erb.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView class Template module Handlers diff --git a/actionview/lib/action_view/template/handlers/erb/deprecated_erubis.rb b/actionview/lib/action_view/template/handlers/erb/deprecated_erubis.rb index 59d6018f93..427ea20064 100644 --- a/actionview/lib/action_view/template/handlers/erb/deprecated_erubis.rb +++ b/actionview/lib/action_view/template/handlers/erb/deprecated_erubis.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true ::ActiveSupport::Deprecation.warn("ActionView::Template::Handlers::Erubis is deprecated and will be removed from Rails 5.2. Switch to ActionView::Template::Handlers::ERB::Erubi instead.") module ActionView diff --git a/actionview/lib/action_view/template/handlers/erb/erubi.rb b/actionview/lib/action_view/template/handlers/erb/erubi.rb index 85750d57ca..755cc84015 100644 --- a/actionview/lib/action_view/template/handlers/erb/erubi.rb +++ b/actionview/lib/action_view/template/handlers/erb/erubi.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "erubi" module ActionView diff --git a/actionview/lib/action_view/template/handlers/erb/erubis.rb b/actionview/lib/action_view/template/handlers/erb/erubis.rb index 43a3731f8b..f3c35e1aec 100644 --- a/actionview/lib/action_view/template/handlers/erb/erubis.rb +++ b/actionview/lib/action_view/template/handlers/erb/erubis.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true gem "erubis" require "erubis" diff --git a/actionview/lib/action_view/template/handlers/html.rb b/actionview/lib/action_view/template/handlers/html.rb index 215de5cfa2..ccaa8d1469 100644 --- a/actionview/lib/action_view/template/handlers/html.rb +++ b/actionview/lib/action_view/template/handlers/html.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Template::Handlers class Html < Raw diff --git a/actionview/lib/action_view/template/handlers/raw.rb b/actionview/lib/action_view/template/handlers/raw.rb index 6fc46aaa93..e7519e94f9 100644 --- a/actionview/lib/action_view/template/handlers/raw.rb +++ b/actionview/lib/action_view/template/handlers/raw.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module Template::Handlers class Raw diff --git a/actionview/lib/action_view/template/html.rb b/actionview/lib/action_view/template/html.rb index e2d2d05ec7..0ffae10432 100644 --- a/actionview/lib/action_view/template/html.rb +++ b/actionview/lib/action_view/template/html.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView #:nodoc: # = Action View HTML Template class Template diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb index 837396bdfd..65f8be26a0 100644 --- a/actionview/lib/action_view/template/resolver.rb +++ b/actionview/lib/action_view/template/resolver.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "pathname" require "active_support/core_ext/class" require "active_support/core_ext/module/attribute_accessors" diff --git a/actionview/lib/action_view/template/text.rb b/actionview/lib/action_view/template/text.rb index 8249b27aa0..380528d6ef 100644 --- a/actionview/lib/action_view/template/text.rb +++ b/actionview/lib/action_view/template/text.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView #:nodoc: # = Action View Text Template class Template diff --git a/actionview/lib/action_view/template/types.rb b/actionview/lib/action_view/template/types.rb index 6f00fd0a3b..21959a3798 100644 --- a/actionview/lib/action_view/template/types.rb +++ b/actionview/lib/action_view/template/types.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/module/attribute_accessors" module ActionView diff --git a/actionview/lib/action_view/test_case.rb b/actionview/lib/action_view/test_case.rb index 0df1314395..424a86ba3e 100644 --- a/actionview/lib/action_view/test_case.rb +++ b/actionview/lib/action_view/test_case.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_support/core_ext/module/remove_method" require "action_controller" require "action_controller/test_case" diff --git a/actionview/lib/action_view/testing/resolvers.rb b/actionview/lib/action_view/testing/resolvers.rb index acd5dc4cb4..b2d3e10690 100644 --- a/actionview/lib/action_view/testing/resolvers.rb +++ b/actionview/lib/action_view/testing/resolvers.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "action_view/template/resolver" module ActionView #:nodoc: diff --git a/actionview/lib/action_view/version.rb b/actionview/lib/action_view/version.rb index 3d4e517f99..315404864d 100644 --- a/actionview/lib/action_view/version.rb +++ b/actionview/lib/action_view/version.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require_relative "gem_version" module ActionView diff --git a/actionview/lib/action_view/view_paths.rb b/actionview/lib/action_view/view_paths.rb index bbff56f88d..938f0fc17f 100644 --- a/actionview/lib/action_view/view_paths.rb +++ b/actionview/lib/action_view/view_paths.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ActionView module ViewPaths extend ActiveSupport::Concern diff --git a/actionview/test/abstract_unit.rb b/actionview/test/abstract_unit.rb index da554b830c..a7d706c5e1 100644 --- a/actionview/test/abstract_unit.rb +++ b/actionview/test/abstract_unit.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true $:.unshift File.expand_path("lib", __dir__) $:.unshift File.expand_path("fixtures/helpers", __dir__) $:.unshift File.expand_path("fixtures/alternate_helpers", __dir__) diff --git a/actionview/test/actionpack/abstract/abstract_controller_test.rb b/actionview/test/actionpack/abstract/abstract_controller_test.rb index 7714f97605..8f65a61493 100644 --- a/actionview/test/actionpack/abstract/abstract_controller_test.rb +++ b/actionview/test/actionpack/abstract/abstract_controller_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "set" diff --git a/actionview/test/actionpack/abstract/helper_test.rb b/actionview/test/actionpack/abstract/helper_test.rb index e3a1614057..13922e4485 100644 --- a/actionview/test/actionpack/abstract/helper_test.rb +++ b/actionview/test/actionpack/abstract/helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" ActionController::Base.helpers_path = File.expand_path("../../fixtures/helpers", __dir__) diff --git a/actionview/test/actionpack/abstract/layouts_test.rb b/actionview/test/actionpack/abstract/layouts_test.rb index e733dc43af..4ece992597 100644 --- a/actionview/test/actionpack/abstract/layouts_test.rb +++ b/actionview/test/actionpack/abstract/layouts_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" module AbstractControllerTests diff --git a/actionview/test/actionpack/abstract/render_test.rb b/actionview/test/actionpack/abstract/render_test.rb index 017e9ed2ff..8b0c54fb77 100644 --- a/actionview/test/actionpack/abstract/render_test.rb +++ b/actionview/test/actionpack/abstract/render_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" module AbstractController diff --git a/actionview/test/actionpack/controller/capture_test.rb b/actionview/test/actionpack/controller/capture_test.rb index 19167333ae..cc3a23c60c 100644 --- a/actionview/test/actionpack/controller/capture_test.rb +++ b/actionview/test/actionpack/controller/capture_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/logger" diff --git a/actionview/test/actionpack/controller/layout_test.rb b/actionview/test/actionpack/controller/layout_test.rb index 8af6539056..b3e0329f57 100644 --- a/actionview/test/actionpack/controller/layout_test.rb +++ b/actionview/test/actionpack/controller/layout_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array/extract_options" diff --git a/actionview/test/actionpack/controller/render_test.rb b/actionview/test/actionpack/controller/render_test.rb index c7990f8d96..6528169312 100644 --- a/actionview/test/actionpack/controller/render_test.rb +++ b/actionview/test/actionpack/controller/render_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_model" require "controller/fake_models" diff --git a/actionview/test/actionpack/controller/view_paths_test.rb b/actionview/test/actionpack/controller/view_paths_test.rb index a0e9842dbf..4c58b959a9 100644 --- a/actionview/test/actionpack/controller/view_paths_test.rb +++ b/actionview/test/actionpack/controller/view_paths_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class ViewLoadPathsTest < ActionController::TestCase diff --git a/actionview/test/active_record_unit.rb b/actionview/test/active_record_unit.rb index 23d5d9814f..901c0e2b3e 100644 --- a/actionview/test/active_record_unit.rb +++ b/actionview/test/active_record_unit.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" # Define the essentials diff --git a/actionview/test/activerecord/controller_runtime_test.rb b/actionview/test/activerecord/controller_runtime_test.rb index 176d9e6d8c..1cec5072c0 100644 --- a/actionview/test/activerecord/controller_runtime_test.rb +++ b/actionview/test/activerecord/controller_runtime_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record_unit" require "active_record/railties/controller_runtime" require "fixtures/project" diff --git a/actionview/test/activerecord/debug_helper_test.rb b/actionview/test/activerecord/debug_helper_test.rb index 6ada7a3e42..06ae555a03 100644 --- a/actionview/test/activerecord/debug_helper_test.rb +++ b/actionview/test/activerecord/debug_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record_unit" require "nokogiri" diff --git a/actionview/test/activerecord/form_helper_activerecord_test.rb b/actionview/test/activerecord/form_helper_activerecord_test.rb index 099b5322ab..9949c3fde0 100644 --- a/actionview/test/activerecord/form_helper_activerecord_test.rb +++ b/actionview/test/activerecord/form_helper_activerecord_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record_unit" require "fixtures/project" require "fixtures/developer" diff --git a/actionview/test/activerecord/polymorphic_routes_test.rb b/actionview/test/activerecord/polymorphic_routes_test.rb index 2fd538fee0..b2e0fb08c4 100644 --- a/actionview/test/activerecord/polymorphic_routes_test.rb +++ b/actionview/test/activerecord/polymorphic_routes_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record_unit" require "fixtures/project" diff --git a/actionview/test/activerecord/relation_cache_test.rb b/actionview/test/activerecord/relation_cache_test.rb index a6d8f2d278..d12c426586 100644 --- a/actionview/test/activerecord/relation_cache_test.rb +++ b/actionview/test/activerecord/relation_cache_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record_unit" class RelationCacheTest < ActionView::TestCase diff --git a/actionview/test/activerecord/render_partial_with_record_identification_test.rb b/actionview/test/activerecord/render_partial_with_record_identification_test.rb index 88e72599d4..60c3ab3045 100644 --- a/actionview/test/activerecord/render_partial_with_record_identification_test.rb +++ b/actionview/test/activerecord/render_partial_with_record_identification_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_record_unit" class RenderPartialWithRecordIdentificationController < ActionController::Base diff --git a/actionview/test/fixtures/actionpack/layouts/builder.builder b/actionview/test/fixtures/actionpack/layouts/builder.builder index 0f34d03a4c..c55488edd0 100644 --- a/actionview/test/fixtures/actionpack/layouts/builder.builder +++ b/actionview/test/fixtures/actionpack/layouts/builder.builder @@ -1,4 +1,3 @@ -# frozen_string_literal: true xml.wrapper do xml << yield end diff --git a/actionview/test/fixtures/actionpack/test/_hello.builder b/actionview/test/fixtures/actionpack/test/_hello.builder index a767060f3c..fc72df16d0 100644 --- a/actionview/test/fixtures/actionpack/test/_hello.builder +++ b/actionview/test/fixtures/actionpack/test/_hello.builder @@ -1,2 +1 @@ -# frozen_string_literal: true xm.hello diff --git a/actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder b/actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder index 568a2ddefe..f98aaa34a5 100644 --- a/actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder +++ b/actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder @@ -1,2 +1 @@ -# frozen_string_literal: true xml.test "failed" diff --git a/actionview/test/fixtures/actionpack/test/hello.builder b/actionview/test/fixtures/actionpack/test/hello.builder index 205ad8722f..b8ab17ad5b 100644 --- a/actionview/test/fixtures/actionpack/test/hello.builder +++ b/actionview/test/fixtures/actionpack/test/hello.builder @@ -1,4 +1,3 @@ -# frozen_string_literal: true xml.html do xml.p "Hello #{@name}" xml << render(file: "test/greeting") diff --git a/actionview/test/fixtures/actionpack/test/hello_world_container.builder b/actionview/test/fixtures/actionpack/test/hello_world_container.builder index f0291694ee..24032ab5e0 100644 --- a/actionview/test/fixtures/actionpack/test/hello_world_container.builder +++ b/actionview/test/fixtures/actionpack/test/hello_world_container.builder @@ -1,4 +1,3 @@ -# frozen_string_literal: true xml.test do render partial: "hello", locals: { xm: xml } end diff --git a/actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder b/actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder index 2a87fd1a3d..619a97ba96 100644 --- a/actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder +++ b/actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder @@ -1,4 +1,3 @@ -# frozen_string_literal: true xml.html do xml.p "Hello" end diff --git a/actionview/test/fixtures/actionpack/test/hello_xml_world.builder b/actionview/test/fixtures/actionpack/test/hello_xml_world.builder index c496fb4160..d16bb6b5cb 100644 --- a/actionview/test/fixtures/actionpack/test/hello_xml_world.builder +++ b/actionview/test/fixtures/actionpack/test/hello_xml_world.builder @@ -1,4 +1,3 @@ -# frozen_string_literal: true xml.html do xml.head do xml.title "Hello World" diff --git a/actionview/test/fixtures/actionpack/test/implicit_content_type.atom.builder b/actionview/test/fixtures/actionpack/test/implicit_content_type.atom.builder index bcb3c79f0b..2fcb32d247 100644 --- a/actionview/test/fixtures/actionpack/test/implicit_content_type.atom.builder +++ b/actionview/test/fixtures/actionpack/test/implicit_content_type.atom.builder @@ -1,3 +1,2 @@ -# frozen_string_literal: true xml.atom do end diff --git a/actionview/test/fixtures/actionpack/test/non_erb_block_content_for.builder b/actionview/test/fixtures/actionpack/test/non_erb_block_content_for.builder index 4db7d66d90..cd65da751b 100644 --- a/actionview/test/fixtures/actionpack/test/non_erb_block_content_for.builder +++ b/actionview/test/fixtures/actionpack/test/non_erb_block_content_for.builder @@ -1,4 +1,3 @@ -# frozen_string_literal: true content_for :title do "Putting stuff in the title!" end diff --git a/actionview/test/fixtures/comments/empty.html.builder b/actionview/test/fixtures/comments/empty.html.builder index ecc1078747..12d6fdd9a5 100644 --- a/actionview/test/fixtures/comments/empty.html.builder +++ b/actionview/test/fixtures/comments/empty.html.builder @@ -1,2 +1 @@ -# frozen_string_literal: true xml.h1 "No Comment" diff --git a/actionview/test/fixtures/company.rb b/actionview/test/fixtures/company.rb index 18a197947a..9f527acdd8 100644 --- a/actionview/test/fixtures/company.rb +++ b/actionview/test/fixtures/company.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Company < ActiveRecord::Base has_one :mascot self.sequence_name = :companies_nonstd_seq diff --git a/actionview/test/fixtures/developer.rb b/actionview/test/fixtures/developer.rb index 59f5f17efe..1a686a33ce 100644 --- a/actionview/test/fixtures/developer.rb +++ b/actionview/test/fixtures/developer.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Developer < ActiveRecord::Base has_and_belongs_to_many :projects has_many :replies diff --git a/actionview/test/fixtures/helpers/abc_helper.rb b/actionview/test/fixtures/helpers/abc_helper.rb index a743c7ee9a..cf2774bb5f 100644 --- a/actionview/test/fixtures/helpers/abc_helper.rb +++ b/actionview/test/fixtures/helpers/abc_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module AbcHelper def bare_a() end end diff --git a/actionview/test/fixtures/helpers/helpery_test_helper.rb b/actionview/test/fixtures/helpers/helpery_test_helper.rb index af67fe1c5c..a4f2951efa 100644 --- a/actionview/test/fixtures/helpers/helpery_test_helper.rb +++ b/actionview/test/fixtures/helpers/helpery_test_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module HelperyTestHelper def helpery_test "Default" diff --git a/actionview/test/fixtures/helpers_missing/invalid_require_helper.rb b/actionview/test/fixtures/helpers_missing/invalid_require_helper.rb index d1d66a7161..6ac6677daa 100644 --- a/actionview/test/fixtures/helpers_missing/invalid_require_helper.rb +++ b/actionview/test/fixtures/helpers_missing/invalid_require_helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "very_invalid_file_name" module InvalidRequireHelper diff --git a/actionview/test/fixtures/mascot.rb b/actionview/test/fixtures/mascot.rb index 212303b838..1c0bd7c8fd 100644 --- a/actionview/test/fixtures/mascot.rb +++ b/actionview/test/fixtures/mascot.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Mascot < ActiveRecord::Base belongs_to :company end diff --git a/actionview/test/fixtures/project.rb b/actionview/test/fixtures/project.rb index a9e4bb44d6..404b12cbab 100644 --- a/actionview/test/fixtures/project.rb +++ b/actionview/test/fixtures/project.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Project < ActiveRecord::Base has_and_belongs_to_many :developers, -> { uniq } diff --git a/actionview/test/fixtures/reply.rb b/actionview/test/fixtures/reply.rb index e9a7828d2d..047522c55b 100644 --- a/actionview/test/fixtures/reply.rb +++ b/actionview/test/fixtures/reply.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Reply < ActiveRecord::Base scope :base, -> { all } belongs_to :topic, -> { includes(:replies) } diff --git a/actionview/test/fixtures/ruby_template.ruby b/actionview/test/fixtures/ruby_template.ruby index 17eda89ad7..93334610a8 100644 --- a/actionview/test/fixtures/ruby_template.ruby +++ b/actionview/test/fixtures/ruby_template.ruby @@ -1,3 +1,2 @@ -# frozen_string_literal: true body = "".dup body << ["Hello", "from", "Ruby", "code"].join(" ") diff --git a/actionview/test/fixtures/test/hello.builder b/actionview/test/fixtures/test/hello.builder index 205ad8722f..b8ab17ad5b 100644 --- a/actionview/test/fixtures/test/hello.builder +++ b/actionview/test/fixtures/test/hello.builder @@ -1,4 +1,3 @@ -# frozen_string_literal: true xml.html do xml.p "Hello #{@name}" xml << render(file: "test/greeting") diff --git a/actionview/test/fixtures/topic.rb b/actionview/test/fixtures/topic.rb index 7e66f53bd5..48a3dfba88 100644 --- a/actionview/test/fixtures/topic.rb +++ b/actionview/test/fixtures/topic.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true class Topic < ActiveRecord::Base has_many :replies, dependent: :destroy end diff --git a/actionview/test/lib/controller/fake_models.rb b/actionview/test/lib/controller/fake_models.rb index c419984997..5250101220 100644 --- a/actionview/test/lib/controller/fake_models.rb +++ b/actionview/test/lib/controller/fake_models.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "active_model" Customer = Struct.new(:name, :id) do diff --git a/actionview/test/template/active_model_helper_test.rb b/actionview/test/template/active_model_helper_test.rb index 030c36b1b2..6b63aa25a5 100644 --- a/actionview/test/template/active_model_helper_test.rb +++ b/actionview/test/template/active_model_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class ActiveModelHelperTest < ActionView::TestCase diff --git a/actionview/test/template/asset_tag_helper_test.rb b/actionview/test/template/asset_tag_helper_test.rb index 3f837ffc33..d1190b1bd7 100644 --- a/actionview/test/template/asset_tag_helper_test.rb +++ b/actionview/test/template/asset_tag_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/ordered_options" diff --git a/actionview/test/template/atom_feed_helper_test.rb b/actionview/test/template/atom_feed_helper_test.rb index fd31dd09f8..7fa5e042fb 100644 --- a/actionview/test/template/atom_feed_helper_test.rb +++ b/actionview/test/template/atom_feed_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" Scroll = Struct.new(:id, :to_param, :title, :body, :updated_at, :created_at) do diff --git a/actionview/test/template/capture_helper_test.rb b/actionview/test/template/capture_helper_test.rb index 657fda405e..7f37523eeb 100644 --- a/actionview/test/template/capture_helper_test.rb +++ b/actionview/test/template/capture_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class CaptureHelperTest < ActionView::TestCase diff --git a/actionview/test/template/compiled_templates_test.rb b/actionview/test/template/compiled_templates_test.rb index 5135b1e90b..adb2be9be4 100644 --- a/actionview/test/template/compiled_templates_test.rb +++ b/actionview/test/template/compiled_templates_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class CompiledTemplatesTest < ActiveSupport::TestCase diff --git a/actionview/test/template/controller_helper_test.rb b/actionview/test/template/controller_helper_test.rb index 1b6f1b95c2..8dd0cedb75 100644 --- a/actionview/test/template/controller_helper_test.rb +++ b/actionview/test/template/controller_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class ControllerHelperTest < ActionView::TestCase diff --git a/actionview/test/template/date_helper_i18n_test.rb b/actionview/test/template/date_helper_i18n_test.rb index eee4340958..207c8a683e 100644 --- a/actionview/test/template/date_helper_i18n_test.rb +++ b/actionview/test/template/date_helper_i18n_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class DateHelperDistanceOfTimeInWordsI18nTests < ActiveSupport::TestCase diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb index 235ac9f338..b9b8194e69 100644 --- a/actionview/test/template/date_helper_test.rb +++ b/actionview/test/template/date_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class DateHelperTest < ActionView::TestCase diff --git a/actionview/test/template/dependency_tracker_test.rb b/actionview/test/template/dependency_tracker_test.rb index f3c1ab4fbf..89917035ff 100644 --- a/actionview/test/template/dependency_tracker_test.rb +++ b/actionview/test/template/dependency_tracker_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "action_view/dependency_tracker" diff --git a/actionview/test/template/digestor_test.rb b/actionview/test/template/digestor_test.rb index b8cae0ab66..de04f3f25d 100644 --- a/actionview/test/template/digestor_test.rb +++ b/actionview/test/template/digestor_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "fileutils" require "action_view/dependency_tracker" diff --git a/actionview/test/template/erb/deprecated_erubis_implementation_test.rb b/actionview/test/template/erb/deprecated_erubis_implementation_test.rb index 511dbf8008..aaf99f85c0 100644 --- a/actionview/test/template/erb/deprecated_erubis_implementation_test.rb +++ b/actionview/test/template/erb/deprecated_erubis_implementation_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" module ERBTest diff --git a/actionview/test/template/erb/form_for_test.rb b/actionview/test/template/erb/form_for_test.rb index e251083fc8..e722b40a9a 100644 --- a/actionview/test/template/erb/form_for_test.rb +++ b/actionview/test/template/erb/form_for_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "template/erb/helper" diff --git a/actionview/test/template/erb/helper.rb b/actionview/test/template/erb/helper.rb index 78fc0d4290..bc1eedc15f 100644 --- a/actionview/test/template/erb/helper.rb +++ b/actionview/test/template/erb/helper.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true module ERBTest class ViewContext include ActionView::Helpers::UrlHelper diff --git a/actionview/test/template/erb/tag_helper_test.rb b/actionview/test/template/erb/tag_helper_test.rb index 65ded0aaf5..233f37c48a 100644 --- a/actionview/test/template/erb/tag_helper_test.rb +++ b/actionview/test/template/erb/tag_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "template/erb/helper" diff --git a/actionview/test/template/erb_util_test.rb b/actionview/test/template/erb_util_test.rb index 69d092b6c6..4412ea37fa 100644 --- a/actionview/test/template/erb_util_test.rb +++ b/actionview/test/template/erb_util_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/json" diff --git a/actionview/test/template/form_collections_helper_test.rb b/actionview/test/template/form_collections_helper_test.rb index ddc2619e7a..6160524eb3 100644 --- a/actionview/test/template/form_collections_helper_test.rb +++ b/actionview/test/template/form_collections_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" Category = Struct.new(:id, :name) diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb index cbfe97159d..df81315b9c 100644 --- a/actionview/test/template/form_helper/form_with_test.rb +++ b/actionview/test/template/form_helper/form_with_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "controller/fake_models" diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb index 6e67da5555..50dee1e999 100644 --- a/actionview/test/template/form_helper_test.rb +++ b/actionview/test/template/form_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "controller/fake_models" diff --git a/actionview/test/template/form_options_helper_i18n_test.rb b/actionview/test/template/form_options_helper_i18n_test.rb index e23bd94307..a1048fbb89 100644 --- a/actionview/test/template/form_options_helper_i18n_test.rb +++ b/actionview/test/template/form_options_helper_i18n_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class FormOptionsHelperI18nTests < ActionView::TestCase diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb index faeb84faef..3247f20ba7 100644 --- a/actionview/test/template/form_options_helper_test.rb +++ b/actionview/test/template/form_options_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class Map < Hash diff --git a/actionview/test/template/form_tag_helper_test.rb b/actionview/test/template/form_tag_helper_test.rb index f4a26e232d..7ac15db9fe 100644 --- a/actionview/test/template/form_tag_helper_test.rb +++ b/actionview/test/template/form_tag_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class FormTagHelperTest < ActionView::TestCase diff --git a/actionview/test/template/html_test.rb b/actionview/test/template/html_test.rb index 17560287bc..60f4b0aee6 100644 --- a/actionview/test/template/html_test.rb +++ b/actionview/test/template/html_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class HTMLTest < ActiveSupport::TestCase diff --git a/actionview/test/template/javascript_helper_test.rb b/actionview/test/template/javascript_helper_test.rb index 43ea8eacc6..67747a7a83 100644 --- a/actionview/test/template/javascript_helper_test.rb +++ b/actionview/test/template/javascript_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class JavaScriptHelperTest < ActionView::TestCase diff --git a/actionview/test/template/log_subscriber_test.rb b/actionview/test/template/log_subscriber_test.rb index 765f644bb4..4c9f84f277 100644 --- a/actionview/test/template/log_subscriber_test.rb +++ b/actionview/test/template/log_subscriber_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/log_subscriber/test_helper" require "action_view/log_subscriber" diff --git a/actionview/test/template/lookup_context_test.rb b/actionview/test/template/lookup_context_test.rb index b55f68e36b..b47d92df34 100644 --- a/actionview/test/template/lookup_context_test.rb +++ b/actionview/test/template/lookup_context_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "abstract_controller/rendering" diff --git a/actionview/test/template/number_helper_test.rb b/actionview/test/template/number_helper_test.rb index 9077dbb0c8..678120a9c9 100644 --- a/actionview/test/template/number_helper_test.rb +++ b/actionview/test/template/number_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class NumberHelperTest < ActionView::TestCase diff --git a/actionview/test/template/output_safety_helper_test.rb b/actionview/test/template/output_safety_helper_test.rb index 3b4b83110c..537b4393ee 100644 --- a/actionview/test/template/output_safety_helper_test.rb +++ b/actionview/test/template/output_safety_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class OutputSafetyHelperTest < ActionView::TestCase diff --git a/actionview/test/template/partial_iteration_test.rb b/actionview/test/template/partial_iteration_test.rb index 3a31134e5b..3ebf3b550a 100644 --- a/actionview/test/template/partial_iteration_test.rb +++ b/actionview/test/template/partial_iteration_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "action_view/renderer/partial_renderer" diff --git a/actionview/test/template/record_identifier_test.rb b/actionview/test/template/record_identifier_test.rb index 529de9a57b..ce446715fd 100644 --- a/actionview/test/template/record_identifier_test.rb +++ b/actionview/test/template/record_identifier_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "controller/fake_models" diff --git a/actionview/test/template/record_tag_helper_test.rb b/actionview/test/template/record_tag_helper_test.rb index ab110d8314..3685230558 100644 --- a/actionview/test/template/record_tag_helper_test.rb +++ b/actionview/test/template/record_tag_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class RecordTagPost diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 909aa81833..1fd8b4fe1a 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "controller/fake_models" diff --git a/actionview/test/template/resolver_cache_test.rb b/actionview/test/template/resolver_cache_test.rb index b881618a1d..0ecfccd375 100644 --- a/actionview/test/template/resolver_cache_test.rb +++ b/actionview/test/template/resolver_cache_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class ResolverCacheTest < ActiveSupport::TestCase diff --git a/actionview/test/template/resolver_patterns_test.rb b/actionview/test/template/resolver_patterns_test.rb index f5a28be400..8e21f4b828 100644 --- a/actionview/test/template/resolver_patterns_test.rb +++ b/actionview/test/template/resolver_patterns_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class ResolverPatternsTest < ActiveSupport::TestCase diff --git a/actionview/test/template/sanitize_helper_test.rb b/actionview/test/template/sanitize_helper_test.rb index 8ca8cb6d17..4d4ed3c35c 100644 --- a/actionview/test/template/sanitize_helper_test.rb +++ b/actionview/test/template/sanitize_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" # The exhaustive tests are in the rails-html-sanitizer gem. diff --git a/actionview/test/template/streaming_render_test.rb b/actionview/test/template/streaming_render_test.rb index 835f101c00..41b9063417 100644 --- a/actionview/test/template/streaming_render_test.rb +++ b/actionview/test/template/streaming_render_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class TestController < ActionController::Base diff --git a/actionview/test/template/tag_helper_test.rb b/actionview/test/template/tag_helper_test.rb index d338ff9d3f..f1e5946e14 100644 --- a/actionview/test/template/tag_helper_test.rb +++ b/actionview/test/template/tag_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class TagHelperTest < ActionView::TestCase diff --git a/actionview/test/template/template_error_test.rb b/actionview/test/template/template_error_test.rb index a5201edfcf..54c1d53b60 100644 --- a/actionview/test/template/template_error_test.rb +++ b/actionview/test/template/template_error_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class TemplateErrorTest < ActiveSupport::TestCase diff --git a/actionview/test/template/template_test.rb b/actionview/test/template/template_test.rb index 817e2e4315..dd131f0246 100644 --- a/actionview/test/template/template_test.rb +++ b/actionview/test/template/template_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true # encoding: US-ASCII require "abstract_unit" require "logger" diff --git a/actionview/test/template/test_case_test.rb b/actionview/test/template/test_case_test.rb index 4a8324b235..3deddd5706 100644 --- a/actionview/test/template/test_case_test.rb +++ b/actionview/test/template/test_case_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "rails/engine" diff --git a/actionview/test/template/test_test.rb b/actionview/test/template/test_test.rb index ecc7a9a5a1..52cac77bc5 100644 --- a/actionview/test/template/test_test.rb +++ b/actionview/test/template/test_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" module PeopleHelper diff --git a/actionview/test/template/testing/fixture_resolver_test.rb b/actionview/test/template/testing/fixture_resolver_test.rb index 45b4e1b309..effe453fc0 100644 --- a/actionview/test/template/testing/fixture_resolver_test.rb +++ b/actionview/test/template/testing/fixture_resolver_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class FixtureResolverTest < ActiveSupport::TestCase diff --git a/actionview/test/template/testing/null_resolver_test.rb b/actionview/test/template/testing/null_resolver_test.rb index cc7a732d21..5346fd3368 100644 --- a/actionview/test/template/testing/null_resolver_test.rb +++ b/actionview/test/template/testing/null_resolver_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class NullResolverTest < ActiveSupport::TestCase diff --git a/actionview/test/template/text_helper_test.rb b/actionview/test/template/text_helper_test.rb index ae923980fa..21ee4cc8e5 100644 --- a/actionview/test/template/text_helper_test.rb +++ b/actionview/test/template/text_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class TextHelperTest < ActionView::TestCase diff --git a/actionview/test/template/text_test.rb b/actionview/test/template/text_test.rb index 4eb571eaa7..72ffd5f3be 100644 --- a/actionview/test/template/text_test.rb +++ b/actionview/test/template/text_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class TextTest < ActiveSupport::TestCase diff --git a/actionview/test/template/translation_helper_test.rb b/actionview/test/template/translation_helper_test.rb index f43e8b9a80..1cfc13f337 100644 --- a/actionview/test/template/translation_helper_test.rb +++ b/actionview/test/template/translation_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" module I18n diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb index 24f9bbec79..a087c5c0cd 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" class UrlHelperTest < ActiveSupport::TestCase diff --git a/actionview/test/ujs/config.ru b/actionview/test/ujs/config.ru index 87f37efe8b..213a41127a 100644 --- a/actionview/test/ujs/config.ru +++ b/actionview/test/ujs/config.ru @@ -1,4 +1,3 @@ -# frozen_string_literal: true $LOAD_PATH.unshift __dir__ require "server" diff --git a/actionview/test/ujs/server.rb b/actionview/test/ujs/server.rb index b31c6b896a..7deb208af0 100644 --- a/actionview/test/ujs/server.rb +++ b/actionview/test/ujs/server.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "rack" require "rails" require "action_controller/railtie" -- cgit v1.2.3 From 310918f6a194bf5752fe1025930881756f5d8a8e Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sun, 2 Jul 2017 02:18:22 +0930 Subject: Avoid shadowed variable --- actionview/lib/action_view/helpers/asset_tag_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/helpers/asset_tag_helper.rb b/actionview/lib/action_view/helpers/asset_tag_helper.rb index 3a854e82d3..a8d37013f9 100644 --- a/actionview/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionview/lib/action_view/helpers/asset_tag_helper.rb @@ -245,8 +245,8 @@ module ActionView end if options[:srcset] && !options[:srcset].is_a?(String) - options[:srcset] = options[:srcset].map do |src, size| - src_path = path_to_image(src, skip_pipeline: skip_pipeline) + options[:srcset] = options[:srcset].map do |src_path, size| + src_path = path_to_image(src_path, skip_pipeline: skip_pipeline) "#{src_path} #{size}" end.join(", ") end -- cgit v1.2.3 From 6642b112cd7cbff690a003db9e4fb0704e659b6d Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sun, 2 Jul 2017 22:47:11 +0900 Subject: Expectation first --- actionview/test/template/form_helper/form_with_test.rb | 8 ++++---- actionview/test/template/form_helper_test.rb | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'actionview') diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb index df81315b9c..c1a8181204 100644 --- a/actionview/test/template/form_helper/form_with_test.rb +++ b/actionview/test/template/form_helper/form_with_test.rb @@ -1642,7 +1642,7 @@ class FormWithActsLikeFormForTest < FormWithTest expected = 0 @post.comments.each do |comment| f.fields(:comments, model: comment) { |cf| - assert_equal cf.index, expected + assert_equal expected, cf.index expected += 1 } end @@ -1656,7 +1656,7 @@ class FormWithActsLikeFormForTest < FormWithTest expected = 0 @post.comments.each do |comment| f.fields(:comments, model: comment) { |cf| - assert_equal cf.index, expected + assert_equal expected, cf.index expected += 1 } end @@ -1669,7 +1669,7 @@ class FormWithActsLikeFormForTest < FormWithTest form_with(model: @post) do |f| expected = 0 f.fields(:comments, model: @post.comments) { |cf| - assert_equal cf.index, expected + assert_equal expected, cf.index expected += 1 } end @@ -1680,7 +1680,7 @@ class FormWithActsLikeFormForTest < FormWithTest form_with(model: @post) do |f| f.fields(:comments, model: Comment.new(321), child_index: "abc") { |cf| - assert_equal cf.index, "abc" + assert_equal "abc", cf.index } end end diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb index 50dee1e999..b24f9ed3f0 100644 --- a/actionview/test/template/form_helper_test.rb +++ b/actionview/test/template/form_helper_test.rb @@ -2893,7 +2893,7 @@ class FormHelperTest < ActionView::TestCase expected = 0 @post.comments.each do |comment| f.fields_for(:comments, comment) { |cf| - assert_equal cf.index, expected + assert_equal expected, cf.index expected += 1 } end @@ -2907,7 +2907,7 @@ class FormHelperTest < ActionView::TestCase expected = 0 @post.comments.each do |comment| f.fields_for(:comments, comment) { |cf| - assert_equal cf.index, expected + assert_equal expected, cf.index expected += 1 } end @@ -2920,7 +2920,7 @@ class FormHelperTest < ActionView::TestCase form_for(@post) do |f| expected = 0 f.fields_for(:comments, @post.comments) { |cf| - assert_equal cf.index, expected + assert_equal expected, cf.index expected += 1 } end @@ -2931,7 +2931,7 @@ class FormHelperTest < ActionView::TestCase form_for(@post) do |f| f.fields_for(:comments, Comment.new(321), child_index: "abc") { |cf| - assert_equal cf.index, "abc" + assert_equal "abc", cf.index } end end -- cgit v1.2.3 From b3f3d49fd6b91c6573b3e10e3d00f65306638927 Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Sat, 1 Jul 2017 23:09:13 +0300 Subject: Prepare AP and AR to be frozen string friendly --- actionview/lib/action_view/log_subscriber.rb | 3 ++- actionview/lib/action_view/template.rb | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/log_subscriber.rb b/actionview/lib/action_view/log_subscriber.rb index 613be2b877..c8623f1e9f 100644 --- a/actionview/lib/action_view/log_subscriber.rb +++ b/actionview/lib/action_view/log_subscriber.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/log_subscriber" module ActionView @@ -83,7 +84,7 @@ module ActionView def log_rendering_start(payload) info do - message = " Rendering #{from_rails_root(payload[:identifier])}" + message = " Rendering #{from_rails_root(payload[:identifier])}".dup message << " within #{from_rails_root(payload[:layout])}" if payload[:layout] message end diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index 3f2546664e..80b294dc3d 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "active_support/core_ext/object/try" require "active_support/core_ext/kernel/singleton_class" require "thread" -- cgit v1.2.3 From b427c461ef37419c5e4fd26f5b30bef1acec602c Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Mon, 10 Jul 2017 22:48:09 +0900 Subject: [Action View] `rubocop -a --only Layout/EmptyLineAfterMagicComment` --- actionview/lib/action_view/log_subscriber.rb | 1 + actionview/lib/action_view/template.rb | 1 + actionview/test/template/template_test.rb | 1 + 3 files changed, 3 insertions(+) (limited to 'actionview') diff --git a/actionview/lib/action_view/log_subscriber.rb b/actionview/lib/action_view/log_subscriber.rb index c8623f1e9f..d4ac77e10f 100644 --- a/actionview/lib/action_view/log_subscriber.rb +++ b/actionview/lib/action_view/log_subscriber.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "active_support/log_subscriber" module ActionView diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index 80b294dc3d..e53c8356af 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "active_support/core_ext/object/try" require "active_support/core_ext/kernel/singleton_class" require "thread" diff --git a/actionview/test/template/template_test.rb b/actionview/test/template/template_test.rb index dd131f0246..d3c08634bc 100644 --- a/actionview/test/template/template_test.rb +++ b/actionview/test/template/template_test.rb @@ -1,4 +1,5 @@ # encoding: US-ASCII + require "abstract_unit" require "logger" -- cgit v1.2.3 From 4183d5dfa1d6d651232a4db44a1fcf71d220af4e Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 16 Jul 2017 18:11:03 +0900 Subject: Enable `Layout/FirstParameterIndentation` cop We have some indentation cops. But now there is a little inconsistent params indentations. Enable `Layout/FirstParameterIndentation` cop to prevent newly inconsistent indentation added and auto-correct to existing violations. --- actionview/test/template/form_helper_test.rb | 4 +- .../test/template/form_options_helper_test.rb | 44 +++++++++++----------- 2 files changed, 24 insertions(+), 24 deletions(-) (limited to 'actionview') diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb index b24f9ed3f0..ec2e6b0959 100644 --- a/actionview/test/template/form_helper_test.rb +++ b/actionview/test/template/form_helper_test.rb @@ -1446,8 +1446,8 @@ class FormHelperTest < ActionView::TestCase check_box("post[]", "secret") ) assert_dom_equal( - %{}, - radio_button("post[]", "title", "Hello World") + %{}, + radio_button("post[]", "title", "Hello World") ) assert_dom_equal( %{}, diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb index 3247f20ba7..792481f432 100644 --- a/actionview/test/template/form_options_helper_test.rb +++ b/actionview/test/template/form_options_helper_test.rb @@ -269,8 +269,8 @@ class FormOptionsHelperTest < ActionView::TestCase def test_collection_options_with_preselected_value_as_string_and_option_value_is_integer albums = [ Album.new(1, "first", "rap"), Album.new(2, "second", "pop")] assert_dom_equal( - %(\n), - options_from_collection_for_select(albums, "id", "genre", selected: "1") + %(\n), + options_from_collection_for_select(albums, "id", "genre", selected: "1") ) end @@ -278,8 +278,8 @@ class FormOptionsHelperTest < ActionView::TestCase albums = [ Album.new("1", "first", "rap"), Album.new("2", "second", "pop")] assert_dom_equal( - %(\n), - options_from_collection_for_select(albums, "id", "genre", selected: 1) + %(\n), + options_from_collection_for_select(albums, "id", "genre", selected: 1) ) end @@ -287,8 +287,8 @@ class FormOptionsHelperTest < ActionView::TestCase albums = [ Album.new(1.0, "first", "rap"), Album.new(2.0, "second", "pop")] assert_dom_equal( - %(\n), - options_from_collection_for_select(albums, "id", "genre", selected: "2.0") + %(\n), + options_from_collection_for_select(albums, "id", "genre", selected: "2.0") ) end @@ -296,8 +296,8 @@ class FormOptionsHelperTest < ActionView::TestCase albums = [ Album.new(1.0, "first", "rap"), Album.new(2.0, "second", "pop")] assert_dom_equal( - %(\n), - options_from_collection_for_select(albums, "id", "genre", selected: nil) + %(\n), + options_from_collection_for_select(albums, "id", "genre", selected: nil) ) end @@ -305,8 +305,8 @@ class FormOptionsHelperTest < ActionView::TestCase albums = [ Album.new(1.0, "first", "rap"), Album.new(2.0, "second", "pop")] assert_dom_equal( - %(\n), - options_from_collection_for_select(albums, "id", "genre", disabled: nil) + %(\n), + options_from_collection_for_select(albums, "id", "genre", disabled: nil) ) end @@ -314,8 +314,8 @@ class FormOptionsHelperTest < ActionView::TestCase albums = [ Album.new(1.0, "first", "rap"), Album.new(2.0, "second", "pop")] assert_dom_equal( - %(\n), - options_from_collection_for_select(albums, "id", "genre", disabled: ["1.0", 2.0]) + %(\n), + options_from_collection_for_select(albums, "id", "genre", disabled: ["1.0", 2.0]) ) end @@ -323,8 +323,8 @@ class FormOptionsHelperTest < ActionView::TestCase albums = [ Album.new(1.0, "first", "rap"), Album.new(2.0, "second", "pop"), Album.new(3.0, "third", "country") ] assert_dom_equal( - %(\n\n), - options_from_collection_for_select(albums, "id", "genre", ["1.0", "3.0"]) + %(\n\n), + options_from_collection_for_select(albums, "id", "genre", ["1.0", "3.0"]) ) end @@ -371,15 +371,15 @@ class FormOptionsHelperTest < ActionView::TestCase def test_grouped_options_for_select_with_selected_and_prompt assert_dom_equal( - "\n", - grouped_options_for_select([["Hats", ["Baseball Cap", "Cowboy Hat"]]], "Cowboy Hat", prompt: "Choose a product...") + "\n", + grouped_options_for_select([["Hats", ["Baseball Cap", "Cowboy Hat"]]], "Cowboy Hat", prompt: "Choose a product...") ) end def test_grouped_options_for_select_with_selected_and_prompt_true assert_dom_equal( - "\n", - grouped_options_for_select([["Hats", ["Baseball Cap", "Cowboy Hat"]]], "Cowboy Hat", prompt: true) + "\n", + grouped_options_for_select([["Hats", ["Baseball Cap", "Cowboy Hat"]]], "Cowboy Hat", prompt: true) ) end @@ -395,8 +395,8 @@ class FormOptionsHelperTest < ActionView::TestCase def test_optgroups_with_with_options_with_hash assert_dom_equal( - "\n\n", - grouped_options_for_select("North America" => ["United States", "Canada"], "Europe" => ["Denmark", "Germany"]) + "\n\n", + grouped_options_for_select("North America" => ["United States", "Canada"], "Europe" => ["Denmark", "Germany"]) ) end @@ -759,8 +759,8 @@ class FormOptionsHelperTest < ActionView::TestCase @post = Post.new @post.category = "" assert_dom_equal( - "", - select("post", "category", [], { prompt: true, include_blank: true }, class: "disabled", disabled: true) + "", + select("post", "category", [], { prompt: true, include_blank: true }, class: "disabled", disabled: true) ) end -- cgit v1.2.3