public
Fork of rails/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/josh/rails.git
Ruby 1.9 compat: helpers


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8409 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
jeremy (author)
Fri Dec 14 18:29:36 -0800 2007
commit  ee0ea35d910174f2a2ce2483672b705960b52f95
tree    83ff3f1bb5664d62c859f40f875489d70f71f847
parent  525cac7f828c432e8f56d56424227b053c78febe
...
 
1
2
3
...
120
121
122
123
 
124
125
126
...
1
2
3
4
...
121
122
123
 
124
125
126
127
0
@@ -1,3 +1,4 @@
0
+# FIXME: helper { ... } is broken on Ruby 1.9
0
 module ActionController #:nodoc:
0
   module Helpers #:nodoc:
0
     HELPERS_DIR = (defined?(RAILS_ROOT) ? "#{RAILS_ROOT}/app/helpers" : "app/helpers")
0
@@ -120,7 +121,7 @@ module ActionController #:nodoc:
0
               begin
0
                 require_dependency(file_name)
0
               rescue LoadError => load_error
0
- requiree = / -- (.*?)(\.rb)?$/.match(load_error).to_a[1]
0
+ requiree = / -- (.*?)(\.rb)?$/.match(load_error.message).to_a[1]
0
                 if requiree == file_name
0
                   msg = "Missing helper file helpers/#{file_name}.rb"
0
                   raise LoadError.new(msg).copy_blame!(load_error)
...
1
2
3
 
4
5
6
...
130
131
132
 
 
133
134
 
135
136
137
 
138
139
140
 
141
142
143
144
145
 
146
147
148
149
 
150
151
152
...
1
2
 
3
4
5
6
...
130
131
132
133
134
135
 
136
137
138
 
139
140
141
 
142
143
144
145
146
 
147
148
149
150
 
151
152
153
154
0
@@ -1,6 +1,6 @@
0
 require File.dirname(__FILE__) + '/../abstract_unit'
0
 
0
-silence_warnings { ActionController::Helpers::HELPERS_DIR = File.dirname(__FILE__) + '/../fixtures/helpers' }
0
+ActionController::Helpers::HELPERS_DIR.replace File.dirname(__FILE__) + '/../fixtures/helpers'
0
 
0
 class TestController < ActionController::Base
0
   attr_accessor :delegate_attr
0
@@ -130,23 +130,25 @@ class HelperTest < Test::Unit::TestCase
0
   end
0
 
0
   def test_all_helpers
0
+ methods = ApplicationController.master_helper_module.instance_methods.map(&:to_s)
0
+
0
     # abc_helper.rb
0
- assert ApplicationController.master_helper_module.instance_methods.include?("bare_a")
0
+ assert methods.include?('bare_a')
0
 
0
     # fun/games_helper.rb
0
- assert ApplicationController.master_helper_module.instance_methods.include?("stratego")
0
+ assert methods.include?('stratego')
0
 
0
     # fun/pdf_helper.rb
0
- assert ApplicationController.master_helper_module.instance_methods.include?("foobar")
0
+ assert methods.include?('foobar')
0
   end
0
 
0
   private
0
     def expected_helper_methods
0
- TestHelper.instance_methods
0
+ TestHelper.instance_methods.map(&:to_s)
0
     end
0
 
0
     def master_helper_methods
0
- @controller_class.master_helper_module.instance_methods
0
+ @controller_class.master_helper_module.instance_methods.map(&:to_s)
0
     end
0
 
0
     def missing_methods

Comments

    No one has commented yet.