public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Check for ActionMailer and ActionController before attempting to eager load 
their view paths
Signed-off-by: Joshua Peek <josh@joshpeek.com>
samgranieri (author)
Thu Jul 24 11:51:54 -0700 2008
josh (committer)
Thu Jul 24 11:51:54 -0700 2008
commit  11fdcf88c2aea72ec84c5d4ab05986f5d35a9a81
tree    16462af165a95e59164310eb673fecd5d13763bf
parent  a87462afcb6c642e59bfcd2e11e3351e2b718c38
...
341
342
343
344
345
 
 
346
347
348
...
341
342
343
 
 
344
345
346
347
348
0
@@ -341,8 +341,8 @@ Run `rake gems:install` to install the missing gems.
0
 
0
     def load_view_paths
0
       ActionView::PathSet::Path.eager_load_templates! if configuration.cache_classes
0
-      ActionMailer::Base.template_root.load
0
-      ActionController::Base.view_paths.load
0
+      ActionMailer::Base.template_root.load if configuration.frameworks.include?(:action_mailer)
0
+      ActionController::Base.view_paths.load if configuration.frameworks.include?(:action_controller)
0
     end
0
 
0
     # Eager load application classes
...
136
137
138
139
 
 
 
 
 
 
 
 
 
140
 
 
 
 
 
 
 
 
 
 
 
141
142
143
...
136
137
138
 
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
0
@@ -136,8 +136,27 @@ uses_mocha 'framework paths' do
0
       end
0
     end
0
 
0
-    protected
0
+    def test_action_mailer_load_paths_set_only_if_action_mailer_in_use
0
+      @config.frameworks = [:action_controller]
0
+      initializer = Rails::Initializer.new @config
0
+      initializer.send :require_frameworks
0
+
0
+      assert_nothing_raised NameError do
0
+        initializer.send :load_view_paths
0
+      end
0
+    end
0
 
0
+    def test_action_controller_load_paths_set_only_if_action_controller_in_use
0
+      @config.frameworks = []
0
+      initializer = Rails::Initializer.new @config
0
+      initializer.send :require_frameworks
0
+
0
+      assert_nothing_raised NameError do
0
+        initializer.send :load_view_paths
0
+      end
0
+    end
0
+
0
+    protected
0
       def assert_framework_path(path)
0
         assert @config.framework_paths.include?(path),
0
           "<#{path.inspect}> not found among <#{@config.framework_paths.inspect}>"

Comments