Skip to content
This repository
Browse code

Test view path loading from the initializer.

Signed-off-by: Joshua Peek <josh@joshpeek.com>
  • Loading branch information...
commit 6099f261ea7c624aa45b47be7573ed1cab7b6b71 1 parent ea5d288
Manfred Stienstra authored February 25, 2009 josh committed February 25, 2009

Showing 1 changed file with 26 additions and 2 deletions. Show diff stats Hide diff stats

  1. 28  railties/test/initializer_test.rb
28  railties/test/initializer_test.rb
@@ -2,6 +2,7 @@
2 2
 require 'initializer'
3 3
 
4 4
 require 'action_view'
  5
+require 'action_mailer'
5 6
 require 'active_record'
6 7
 
7 8
 # Mocks out the configuration
@@ -330,7 +331,7 @@ def setup
330 331
     @config.frameworks = [:active_record, :action_controller, :action_view]
331 332
   end
332 333
 
333  
-  def test_database_middleware_doesnt_perform_anything_when_active_record_in_frameworks
  334
+  def test_initialize_database_middleware_doesnt_perform_anything_when_active_record_not_in_frameworks
334 335
     @config.frameworks.clear
335 336
     @config.expects(:middleware).never
336 337
     Rails::Initializer.run(:initialize_database_middleware, @config)
@@ -360,7 +361,30 @@ def test_database_middleware_doesnt_initialize_when_session_store_is_not_active_
360 361
 
361 362
     Rails::Initializer.run(:initialize_database_middleware, @config)
362 363
   ensure
363  
-    ActionController::Base.session_store = store    
  364
+    ActionController::Base.session_store = store
  365
+  end
  366
+end
  367
+
  368
+class InitializerViewPathsTest  < Test::Unit::TestCase
  369
+  def setup
  370
+    @config = Rails::Configuration.new
  371
+    @config.frameworks = [:action_view, :action_controller, :action_mailer]
  372
+    
  373
+    ActionController::Base.stubs(:view_paths).returns(stub)
  374
+    ActionMailer::Base.stubs(:view_paths).returns(stub)
  375
+  end
  376
+  
  377
+  def test_load_view_paths_doesnt_perform_anything_when_action_view_not_in_frameworks
  378
+    @config.frameworks -= [:action_view]
  379
+    ActionController::Base.view_paths.expects(:load!).never
  380
+    ActionMailer::Base.view_paths.expects(:load!).never
  381
+    Rails::Initializer.run(:load_view_paths, @config)
  382
+  end
  383
+  
  384
+  def test_load_view_paths_loads_view_paths
  385
+    ActionController::Base.view_paths.expects(:load!)
  386
+    ActionMailer::Base.view_paths.expects(:load!)
  387
+    Rails::Initializer.run(:load_view_paths, @config)
364 388
   end
365 389
 end
366 390
 

3 notes on commit 6099f26

Jeremy Kemper
Owner

This incorrectly assumes action_mailer is in the load path.

Jeremy Kemper
Owner

fixed: http://github.com/rails/rails/commit/dec91a2e0655d288bd5184c981e2f4c60d9b3cf1

John Maya

thanks will include it.

Please sign in to comment.
Something went wrong with that request. Please try again.