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 131 131 132 132 def test_all_helpers 133 133 # 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") 135 135 136 136 # 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") 138 138 139 139 # 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") 141 141 end 142 142 143 143 private 144 144 def expected_helper_methods 145 TestHelper.instance_methods 145 TestHelper.instance_methods.map(&:to_s) 146 146 end 147 147 148 148 def master_helper_methods 149 @controller_class.master_helper_module.instance_methods 149 @controller_class.master_helper_module.instance_methods.map(&:to_s) 150 150 end 151 151 152 152 def missing_methods -
actionpack/test/controller/filters_test.rb
old new 696 696 end 697 697 698 698 class ControllerWithWrongFilterType < PostsController 699 around_filter lambda{ yield }, :only => :no_raise699 around_filter proc { yield }, :only => :no_raise 700 700 end 701 701 702 702 class ControllerWithNestedFilters < ControllerWithSymbolAsFilter -
actionpack/test/template/form_helper_test.rb
old new 463 463 end 464 464 465 465 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') 467 467 end 468 468 469 469 def test_form_for_and_fields_for -
actionpack/lib/action_controller/helpers.rb
old new 120 120 begin 121 121 require_dependency(file_name) 122 122 rescue LoadError => load_error 123 requiree = / -- (.*?)(\.rb)?$/.match(load_error ).to_a[1]123 requiree = / -- (.*?)(\.rb)?$/.match(load_error.message).to_a[1] 124 124 if requiree == file_name 125 125 msg = "Missing helper file helpers/#{file_name}.rb" 126 126 raise LoadError.new(msg).copy_blame!(load_error) -
actionpack/lib/action_controller/filters.rb
old new 376 376 # 377 377 # The object of type Filter is passed to the block when yielded, not the filter itself. 378 378 def find_filter(filter, &block) #:nodoc: 379 filter_chain. select { |f| f.filter == filter && (!block_given? || yield(f)) }.first379 filter_chain.detect { |f| f.filter == filter && (!block_given? || yield(f)) } 380 380 end 381 381 382 382 # Returns true if the filter is excluded from the given action … … 620 620 filters.inject({}) { |h,f| h.update( f => (actions.blank? ? nil : actions)) } 621 621 end 622 622 623 def skip_filter_in_chain(*filters , &test) #:nodoc:623 def skip_filter_in_chain(*filters) #:nodoc: 624 624 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) } 626 626 filters.compact! 627 627 628 628 if conditions.empty? -
actionpack/lib/action_view/base.rb
old new 450 450 # Asserts the existence of a template. 451 451 def template_exists?(template_path, extension) 452 452 file_path = full_template_path(template_path, extension) 453 !file_path.blank? && @@method_names.has_key?(file_path) || FileTest.exist s?(file_path)453 !file_path.blank? && @@method_names.has_key?(file_path) || FileTest.exist?(file_path) 454 454 end 455 455 456 456 # Splits the path and extension from the given template_path and returns as an array. … … 584 584 if file_name 585 585 s = File.expand_path(file_name) 586 586 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 } 588 588 s 589 589 else 590 590 (@@inline_template_count += 1).to_s