Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Set global ActionController::Base.view_paths for test cases

  • Loading branch information...
commit 30204c4e66cea989c4ee48b52c8827c79e98f14a 1 parent 65fb2e7
@josh josh authored
View
4 actionpack/test/abstract_unit.rb
@@ -22,7 +22,9 @@
ActionController::Base.logger = nil
ActionController::Routing::Routes.reload rescue nil
-FIXTURE_LOAD_PATH = ActionView::ViewLoadPaths::LoadPath.new(File.join(File.dirname(__FILE__), 'fixtures'))
+ActionView::Base.cache_template_loading = true
+FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), 'fixtures')
+ActionController::Base.view_paths = FIXTURE_LOAD_PATH
# Wrap tests that use Mocha and skip if unavailable.
def uses_mocha(test_name)
View
8 actionpack/test/activerecord/render_partial_with_record_identification_test.rb
@@ -41,8 +41,6 @@ def render_with_record_collection
end
end
-RenderPartialWithRecordIdentificationController.view_paths = [FIXTURE_LOAD_PATH]
-
class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase
fixtures :developers, :projects, :developers_projects, :topics, :replies, :companies, :mascots
@@ -123,8 +121,6 @@ def render_with_record_collection
end
end
-RenderPartialWithRecordIdentificationController.view_paths = [FIXTURE_LOAD_PATH]
-
class Game < Struct.new(:name, :id)
def to_param
id.to_s
@@ -142,8 +138,6 @@ def render_with_record_collection_in_nested_controller
end
end
- NestedController.view_paths = [FIXTURE_LOAD_PATH]
-
module Serious
class NestedDeeperController < ActionController::Base
def render_with_record_in_deeper_nested_controller
@@ -154,8 +148,6 @@ def render_with_record_collection_in_deeper_nested_controller
render :partial => [ Game.new("Chess"), Game.new("Sudoku"), Game.new("Solitaire") ]
end
end
-
- NestedDeeperController.view_paths = [FIXTURE_LOAD_PATH]
end
end
View
8 actionpack/test/controller/action_pack_assertions_test.rb
@@ -164,14 +164,6 @@ def redirect_to_top_level_named_route
end
end
-# ---------------------------------------------------------------------------
-
-
-# tell the controller where to find its templates but start from parent
-# directory of test_request_response to simulate the behaviour of a
-# production environment
-ActionPackAssertionsController.view_paths = [FIXTURE_LOAD_PATH]
-
# a test case to exercise the new capabilities TestRequest & TestResponse
class ActionPackAssertionsControllerTest < Test::Unit::TestCase
# let's get this party started
View
2  actionpack/test/controller/addresses_render_test.rb
@@ -19,8 +19,6 @@ def self.controller_name; "addresses"; end
def self.controller_path; "addresses"; end
end
-AddressesTestController.view_paths = [FIXTURE_LOAD_PATH]
-
class AddressesTest < Test::Unit::TestCase
def setup
@controller = AddressesTestController.new
View
3  actionpack/test/controller/caching_test.rb
@@ -6,7 +6,6 @@
FILE_STORE_PATH = File.join(File.dirname(__FILE__), '/../temp/', CACHE_DIR)
ActionController::Base.page_cache_directory = FILE_STORE_PATH
ActionController::Base.cache_store = :file_store, FILE_STORE_PATH
-ActionController::Base.view_paths = [FIXTURE_LOAD_PATH]
class PageCachingTestController < ActionController::Base
caches_page :ok, :no_content, :if => Proc.new { |c| !c.request.format.json? }
@@ -636,8 +635,6 @@ def rescue_action(e)
end
end
-FunctionalCachingController.view_paths = [FIXTURE_LOAD_PATH]
-
class FunctionalFragmentCachingTest < Test::Unit::TestCase
def setup
ActionController::Base.perform_caching = true
View
2  actionpack/test/controller/capture_test.rb
@@ -23,8 +23,6 @@ def non_erb_block_content_for
def rescue_action(e) raise end
end
-CaptureController.view_paths = [FIXTURE_LOAD_PATH]
-
class CaptureTest < Test::Unit::TestCase
def setup
@controller = CaptureController.new
View
2  actionpack/test/controller/content_type_test.rb
@@ -45,8 +45,6 @@ def render_default_content_types_for_respond_to
def rescue_action(e) raise end
end
-ContentTypeController.view_paths = [FIXTURE_LOAD_PATH]
-
class ContentTypeTest < Test::Unit::TestCase
def setup
@controller = ContentTypeController.new
View
2  actionpack/test/controller/deprecation/deprecated_base_methods_test.rb
@@ -13,8 +13,6 @@ def raises_name_error
def rescue_action(e) raise e end
end
- Target.view_paths = [FIXTURE_LOAD_PATH]
-
def setup
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
View
2  actionpack/test/controller/mime_responds_test.rb
@@ -162,8 +162,6 @@ def set_layout
end
end
-RespondToController.view_paths = [FIXTURE_LOAD_PATH]
-
class MimeControllerTest < Test::Unit::TestCase
def setup
ActionController::Base.use_accept_header = true
View
3  actionpack/test/controller/new_render_test.rb
@@ -465,9 +465,6 @@ def determine_layout
end
end
-NewRenderTestController.view_paths = [FIXTURE_LOAD_PATH]
-Fun::GamesController.view_paths = [FIXTURE_LOAD_PATH]
-
class NewRenderTest < Test::Unit::TestCase
def setup
@controller = NewRenderTestController.new
View
3  actionpack/test/controller/render_test.rb
@@ -217,9 +217,6 @@ def determine_layout
end
end
-TestController.view_paths = [FIXTURE_LOAD_PATH]
-Fun::GamesController.view_paths = [FIXTURE_LOAD_PATH]
-
class RenderTest < Test::Unit::TestCase
def setup
@request = ActionController::TestRequest.new
View
2  actionpack/test/controller/send_file_test.rb
@@ -19,8 +19,6 @@ def data() send_data(file_data, options) end
def rescue_action(e) raise end
end
-SendFileController.view_paths = [FIXTURE_LOAD_PATH]
-
class SendFileTest < Test::Unit::TestCase
include TestFileUtils
View
2  actionpack/test/controller/view_paths_test.rb
@@ -1,8 +1,6 @@
require 'abstract_unit'
class ViewLoadPathsTest < Test::Unit::TestCase
- ActionController::Base.view_paths = [FIXTURE_LOAD_PATH]
-
class TestController < ActionController::Base
def self.controller_path() "test" end
def rescue_action(e) raise end
View
2  actionpack/test/template/render_test.rb
@@ -4,7 +4,7 @@
class ViewRenderTest < Test::Unit::TestCase
def setup
@assigns = { :secret => 'in the sauce' }
- @view = ActionView::Base.new([FIXTURE_LOAD_PATH], @assigns)
+ @view = ActionView::Base.new(ActionController::Base.view_paths, @assigns)
end
def test_render_file
View
8 actionpack/test/template/url_helper_test.rb
@@ -302,8 +302,6 @@ def protect_against_forgery?
class UrlHelperWithControllerTest < ActionView::TestCase
class UrlHelperController < ActionController::Base
- self.view_paths = [FIXTURE_LOAD_PATH]
-
def self.controller_path; 'url_helper_with_controller' end
def show_url_for
@@ -366,8 +364,6 @@ def with_url_helper_routing
class LinkToUnlessCurrentWithControllerTest < ActionView::TestCase
class TasksController < ActionController::Base
- self.view_paths = [FIXTURE_LOAD_PATH]
-
def self.controller_path; 'tasks' end
def index
@@ -458,8 +454,6 @@ def to_s
class PolymorphicControllerTest < ActionView::TestCase
class WorkshopsController < ActionController::Base
- self.view_paths = [FIXTURE_LOAD_PATH]
-
def self.controller_path; 'workshops' end
def index
@@ -476,8 +470,6 @@ def rescue_action(e) raise e end
end
class SessionsController < ActionController::Base
- self.view_paths = [FIXTURE_LOAD_PATH]
-
def self.controller_path; 'sessions' end
def index
Please sign in to comment.
Something went wrong with that request. Please try again.