Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Test view path loading from the initializer.

Signed-off-by: Joshua Peek <josh@joshpeek.com>
  • Loading branch information...
commit 6099f261ea7c624aa45b47be7573ed1cab7b6b71 1 parent ea5d288
@Manfred Manfred authored josh committed
Showing with 26 additions and 2 deletions.
  1. +26 −2 railties/test/initializer_test.rb
View
28 railties/test/initializer_test.rb
@@ -2,6 +2,7 @@
require 'initializer'
require 'action_view'
+require 'action_mailer'
require 'active_record'
# Mocks out the configuration
@@ -330,7 +331,7 @@ def setup
@config.frameworks = [:active_record, :action_controller, :action_view]
end
- def test_database_middleware_doesnt_perform_anything_when_active_record_in_frameworks
+ def test_initialize_database_middleware_doesnt_perform_anything_when_active_record_not_in_frameworks
@config.frameworks.clear
@config.expects(:middleware).never
Rails::Initializer.run(:initialize_database_middleware, @config)
@@ -360,7 +361,30 @@ def test_database_middleware_doesnt_initialize_when_session_store_is_not_active_
Rails::Initializer.run(:initialize_database_middleware, @config)
ensure
- ActionController::Base.session_store = store
+ ActionController::Base.session_store = store
+ end
+end
+
+class InitializerViewPathsTest < Test::Unit::TestCase
+ def setup
+ @config = Rails::Configuration.new
+ @config.frameworks = [:action_view, :action_controller, :action_mailer]
+
+ ActionController::Base.stubs(:view_paths).returns(stub)
+ ActionMailer::Base.stubs(:view_paths).returns(stub)
+ end
+
+ def test_load_view_paths_doesnt_perform_anything_when_action_view_not_in_frameworks
+ @config.frameworks -= [:action_view]
+ ActionController::Base.view_paths.expects(:load!).never
+ ActionMailer::Base.view_paths.expects(:load!).never
+ Rails::Initializer.run(:load_view_paths, @config)
+ end
+
+ def test_load_view_paths_loads_view_paths
+ ActionController::Base.view_paths.expects(:load!)
+ ActionMailer::Base.view_paths.expects(:load!)
+ Rails::Initializer.run(:load_view_paths, @config)
end
end

3 comments on commit 6099f26

@jeremy
Owner

This incorrectly assumes action_mailer is in the load path.

@jeremy
Owner

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

@jmaya

thanks will include it.

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