diff options
author | Andrew White <pixeltrix@users.noreply.github.com> | 2016-11-11 20:05:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-11 20:05:10 +0000 |
commit | 6b830dc930a5d684c05b028757b06834df4d064d (patch) | |
tree | cce822e4496b50a6bd5b121a540447f59f59e3e4 /actionpack | |
parent | e4b0a5f66ebd2b7f29e4f868d2f6b2504df091e6 (diff) | |
parent | 9b103311d5d266fa509f5da8825ea5daecba1836 (diff) | |
download | rails-6b830dc930a5d684c05b028757b06834df4d064d.tar.gz rails-6b830dc930a5d684c05b028757b06834df4d064d.tar.bz2 rails-6b830dc930a5d684c05b028757b06834df4d064d.zip |
Merge pull request #26962 from rails/fix-3-2-stable-on-ruby-2-3
Fix Rails 3-2-stable on Ruby 2.3.1
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/actionpack.gemspec | 2 | ||||
-rw-r--r-- | actionpack/lib/abstract_controller/helpers.rb | 15 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/template.rb | 3 | ||||
-rw-r--r-- | actionpack/lib/sprockets/helpers/rails_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/test/abstract/helper_test.rb | 5 | ||||
-rw-r--r-- | actionpack/test/abstract_unit.rb | 3 | ||||
-rw-r--r-- | actionpack/test/template/date_helper_test.rb | 2 |
8 files changed, 27 insertions, 7 deletions
diff --git a/actionpack/actionpack.gemspec b/actionpack/actionpack.gemspec index cd906c0cdc..c795e35ac7 100644 --- a/actionpack/actionpack.gemspec +++ b/actionpack/actionpack.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |s| s.add_dependency('activesupport', version) s.add_dependency('activemodel', version) s.add_dependency('rack-cache', '~> 1.2') - s.add_dependency('builder', '~> 3.0.0') + s.add_dependency('builder', '~> 3.0') s.add_dependency('rack', '~> 1.4.5') s.add_dependency('rack-test', '~> 0.6.1') s.add_dependency('journey', '~> 1.0.4') diff --git a/actionpack/lib/abstract_controller/helpers.rb b/actionpack/lib/abstract_controller/helpers.rb index 77cc4c07d9..7a9055a679 100644 --- a/actionpack/lib/abstract_controller/helpers.rb +++ b/actionpack/lib/abstract_controller/helpers.rb @@ -12,6 +12,15 @@ module AbstractController self._helper_methods = Array.new end + class MissingHelperError < LoadError + def initialize(error, path) + @error = error + @path = "helpers/#{path}.rb" + set_backtrace error.backtrace + super("Missing helper file helpers/%s.rb" % path) + end + end + module ClassMethods # When a class is inherited, wrap its helper module in a new module. # This ensures that the parent class's module can be changed @@ -132,7 +141,11 @@ module AbstractController case arg when String, Symbol file_name = "#{arg.to_s.underscore}_helper" - require_dependency(file_name, "Missing helper file helpers/%s.rb") + begin + require_dependency(file_name) + rescue LoadError => e + raise MissingHelperError.new(e, file_name) + end file_name.camelize.constantize when Module arg diff --git a/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb b/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb index 05d5f1870a..edfc374b3b 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb @@ -47,7 +47,7 @@ module ActionView if concat || (config.perform_caching && cache) joined_name = (cache == true ? "all" : cache) + ".#{extension}" joined_path = File.join((joined_name[/^#{File::SEPARATOR}/] ? config.assets_dir : custom_dir), joined_name) - unless config.perform_caching && File.exists?(joined_path) + unless config.perform_caching && File.exist?(joined_path) write_asset_file_contents(joined_path, compute_paths(sources, recursive)) end asset_tag(joined_name, options) diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb index e67e52cc76..069ac4e761 100644 --- a/actionpack/lib/action_view/template.rb +++ b/actionpack/lib/action_view/template.rb @@ -323,7 +323,8 @@ module ActionView end def locals_code #:nodoc: - @locals.map { |key| "#{key} = local_assigns[:#{key}];" }.join + # Double assign to suppress the dreaded 'assigned but unused variable' warning + @locals.map { |key| "#{key} = #{key} = local_assigns[:#{key}];" }.join end def method_name #:nodoc: diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb index 243c2e5e50..6712aefb2d 100644 --- a/actionpack/lib/sprockets/helpers/rails_helper.rb +++ b/actionpack/lib/sprockets/helpers/rails_helper.rb @@ -163,7 +163,7 @@ module Sprockets source elsif source_ext.blank? "#{source}.#{ext}" - elsif File.exists?(source) || exact_match_present?(source) + elsif File.exist?(source) || exact_match_present?(source) source else "#{source}.#{ext}" diff --git a/actionpack/test/abstract/helper_test.rb b/actionpack/test/abstract/helper_test.rb index b28a5b5afb..2e86e7e859 100644 --- a/actionpack/test/abstract/helper_test.rb +++ b/actionpack/test/abstract/helper_test.rb @@ -69,7 +69,10 @@ module AbstractController end def test_declare_missing_helper - assert_raise(MissingSourceFile) { AbstractHelpers.helper :missing } + e = assert_raise AbstractController::Helpers::MissingHelperError do + AbstractHelpers.helper :missing + end + assert_equal "helpers/missing_helper.rb", e.path end def test_helpers_with_module_through_block diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 74efcba666..7ea2c5f061 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -51,6 +51,9 @@ ActiveSupport::Dependencies.hook! # Show backtraces for deprecated behavior for quicker cleanup. ActiveSupport::Deprecation.debug = true +# Disable available locale checks to avoid warnings running the test suite. +I18n.enforce_available_locales = false + # Register danish language for testing I18n.backend.store_translations 'da', {} I18n.backend.store_translations 'pt-BR', {} diff --git a/actionpack/test/template/date_helper_test.rb b/actionpack/test/template/date_helper_test.rb index ad46ff4429..ea4b1611cf 100644 --- a/actionpack/test/template/date_helper_test.rb +++ b/actionpack/test/template/date_helper_test.rb @@ -1386,7 +1386,7 @@ class DateHelperTest < ActionView::TestCase expected << %(<option value="">Choose seconds</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18" selected="selected">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n) expected << "</select>\n" - assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :prompt => true, :include_seconds => true, + assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :include_seconds => true, :prompt => {:hour => 'Choose hour', :minute => 'Choose minute', :second => 'Choose seconds'}) end |