1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Set global ActionController::Base.view_paths for test cases

This commit is contained in:
Joshua Peek 2008-07-12 14:11:51 -05:00
parent 65fb2e76f2
commit 30204c4e66
15 changed files with 4 additions and 49 deletions

View file

@ -22,7 +22,9 @@ ActiveSupport::Deprecation.debug = true
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 file

@ -41,8 +41,6 @@ class RenderPartialWithRecordIdentificationController < ActionController::Base
end
end
RenderPartialWithRecordIdentificationController.view_paths = [FIXTURE_LOAD_PATH]
class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase
fixtures :developers, :projects, :developers_projects, :topics, :replies, :companies, :mascots
@ -123,8 +121,6 @@ class RenderPartialWithRecordIdentificationController < ActionController::Base
end
end
RenderPartialWithRecordIdentificationController.view_paths = [FIXTURE_LOAD_PATH]
class Game < Struct.new(:name, :id)
def to_param
id.to_s
@ -142,8 +138,6 @@ module Fun
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 @@ module Fun
render :partial => [ Game.new("Chess"), Game.new("Sudoku"), Game.new("Solitaire") ]
end
end
NestedDeeperController.view_paths = [FIXTURE_LOAD_PATH]
end
end

View file

@ -164,14 +164,6 @@ module Admin
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 file

@ -19,8 +19,6 @@ class AddressesTestController < ActionController::Base
def self.controller_path; "addresses"; end
end
AddressesTestController.view_paths = [FIXTURE_LOAD_PATH]
class AddressesTest < Test::Unit::TestCase
def setup
@controller = AddressesTestController.new

View file

@ -6,7 +6,6 @@ CACHE_DIR = 'test_cache'
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 @@ class FunctionalCachingController < ActionController::Base
end
end
FunctionalCachingController.view_paths = [FIXTURE_LOAD_PATH]
class FunctionalFragmentCachingTest < Test::Unit::TestCase
def setup
ActionController::Base.perform_caching = true

View file

@ -23,8 +23,6 @@ class CaptureController < ActionController::Base
def rescue_action(e) raise end
end
CaptureController.view_paths = [FIXTURE_LOAD_PATH]
class CaptureTest < Test::Unit::TestCase
def setup
@controller = CaptureController.new

View file

@ -45,8 +45,6 @@ class ContentTypeController < ActionController::Base
def rescue_action(e) raise end
end
ContentTypeController.view_paths = [FIXTURE_LOAD_PATH]
class ContentTypeTest < Test::Unit::TestCase
def setup
@controller = ContentTypeController.new

View file

@ -13,8 +13,6 @@ class DeprecatedBaseMethodsTest < Test::Unit::TestCase
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 file

@ -162,8 +162,6 @@ class RespondToController < ActionController::Base
end
end
RespondToController.view_paths = [FIXTURE_LOAD_PATH]
class MimeControllerTest < Test::Unit::TestCase
def setup
ActionController::Base.use_accept_header = true

View file

@ -465,9 +465,6 @@ class NewRenderTestController < ActionController::Base
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 file

@ -217,9 +217,6 @@ class TestController < ActionController::Base
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 file

@ -19,8 +19,6 @@ class SendFileController < ActionController::Base
def rescue_action(e) raise end
end
SendFileController.view_paths = [FIXTURE_LOAD_PATH]
class SendFileTest < Test::Unit::TestCase
include TestFileUtils

View file

@ -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 file

@ -4,7 +4,7 @@ require 'controller/fake_models'
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 file

@ -302,8 +302,6 @@ end
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 @@ end
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 @@ end
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 @@ class PolymorphicControllerTest < ActionView::TestCase
end
class SessionsController < ActionController::Base
self.view_paths = [FIXTURE_LOAD_PATH]
def self.controller_path; 'sessions' end
def index