Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #1689: more_actionpack_19.patch

File more_actionpack_19.patch, 5.2 kB (added by lifofifo, 9 months ago)
  • actionpack/test/controller/helper_test.rb

    old new  
    131131 
    132132  def test_all_helpers 
    133133    # abc_helper.rb 
    134     assert ApplicationController.master_helper_module.instance_methods.include?("bare_a") 
     134    assert ApplicationController.master_helper_module.instance_methods.map(&:to_s).include?("bare_a") 
    135135 
    136136    # fun/games_helper.rb 
    137     assert ApplicationController.master_helper_module.instance_methods.include?("stratego") 
     137    assert ApplicationController.master_helper_module.instance_methods.map(&:to_s).include?("stratego") 
    138138 
    139139    # fun/pdf_helper.rb 
    140     assert ApplicationController.master_helper_module.instance_methods.include?("foobar") 
     140    assert ApplicationController.master_helper_module.instance_methods.map(&:to_s).include?("foobar") 
    141141  end 
    142142 
    143143  private 
    144144    def expected_helper_methods 
    145       TestHelper.instance_methods 
     145      TestHelper.instance_methods.map(&:to_s) 
    146146    end 
    147147 
    148148    def master_helper_methods 
    149       @controller_class.master_helper_module.instance_methods 
     149      @controller_class.master_helper_module.instance_methods.map(&:to_s) 
    150150    end 
    151151 
    152152    def missing_methods 
  • actionpack/test/controller/filters_test.rb

    old new  
    696696end 
    697697 
    698698class ControllerWithWrongFilterType < PostsController 
    699   around_filter lambda { yield }, :only => :no_raise 
     699  around_filter proc { yield }, :only => :no_raise 
    700700end 
    701701 
    702702class ControllerWithNestedFilters < ControllerWithSymbolAsFilter 
  • actionpack/test/template/form_helper_test.rb

    old new  
    463463  end 
    464464 
    465465  def test_form_builder_does_not_have_form_for_method 
    466     assert ! ActionView::Helpers::FormBuilder.instance_methods.include?('form_for') 
     466    assert ! ActionView::Helpers::FormBuilder.instance_methods.map(&:to_s).include?('form_for') 
    467467  end 
    468468 
    469469  def test_form_for_and_fields_for 
  • actionpack/lib/action_controller/helpers.rb

    old new  
    120120              begin 
    121121                require_dependency(file_name) 
    122122              rescue LoadError => load_error 
    123                 requiree = / -- (.*?)(\.rb)?$/.match(load_error).to_a[1] 
     123                requiree = / -- (.*?)(\.rb)?$/.match(load_error.message).to_a[1] 
    124124                if requiree == file_name 
    125125                  msg = "Missing helper file helpers/#{file_name}.rb" 
    126126                  raise LoadError.new(msg).copy_blame!(load_error) 
  • actionpack/lib/action_controller/filters.rb

    old new  
    376376      # 
    377377      # The object of type Filter is passed to the block when yielded, not the filter itself. 
    378378      def find_filter(filter, &block) #:nodoc: 
    379         filter_chain.select { |f| f.filter == filter && (!block_given? || yield(f)) }.first 
     379        filter_chain.detect { |f| f.filter == filter && (!block_given? || yield(f)) } 
    380380      end 
    381381 
    382382      # Returns true if the filter is excluded from the given action 
     
    620620          filters.inject({}) { |h,f| h.update( f => (actions.blank? ? nil : actions)) } 
    621621        end 
    622622 
    623         def skip_filter_in_chain(*filters, &test) #:nodoc: 
     623        def skip_filter_in_chain(*filters) #:nodoc: 
    624624          filters, conditions = extract_conditions(filters) 
    625           filters.map! { |f| block_given? ? find_filter(f, &test) : find_filter(f) } 
     625          filters.map! { |f| find_filter(f) } 
    626626          filters.compact! 
    627627 
    628628          if conditions.empty? 
  • actionpack/lib/action_view/base.rb

    old new  
    450450      # Asserts the existence of a template. 
    451451      def template_exists?(template_path, extension) 
    452452        file_path = full_template_path(template_path, extension) 
    453         !file_path.blank? && @@method_names.has_key?(file_path) || FileTest.exists?(file_path) 
     453        !file_path.blank? && @@method_names.has_key?(file_path) || FileTest.exist?(file_path) 
    454454      end 
    455455 
    456456      # Splits the path and extension from the given template_path and returns as an array. 
     
    584584        if file_name 
    585585          s = File.expand_path(file_name) 
    586586          s.sub!(/^#{Regexp.escape(File.expand_path(RAILS_ROOT))}/, '') if defined?(RAILS_ROOT) 
    587           s.gsub!(/([^a-zA-Z0-9_])/) { $1[0].to_s } 
     587          s.gsub!(/([^a-zA-Z0-9_])/) { $1[0].respond_to?(:ord) ? $1[0].ord : $1[0].to_s } 
    588588          s 
    589589        else 
    590590          (@@inline_template_count += 1).to_s