Namespace
- MODULE ViewLoadPathsTest::Test
- CLASS ViewLoadPathsTest::TestController
Methods
- A
- E
- F
- N
- S
- T
-
- teardown,
- test_controller_appends_view_path_correctly,
- test_controller_prepends_view_path_correctly,
- test_decorate_view_paths_with_custom_resolver,
- test_inheritance,
- test_lookup_context_accessor,
- test_template_appends_view_path_correctly,
- test_template_load_path_was_set_correctly,
- test_template_prepends_view_path_correctly,
- test_view_paths,
- test_view_paths_override,
- test_view_paths_override_at_request_time,
- test_view_paths_override_for_layouts_in_controllers_with_a_module
Class Public methods
new(path_set)
Link
Instance Public methods
assert_paths(*paths)
Link
expand(array)
Link
find_all(*args)
Link
# File actionpack/test/controller/view_paths_test.rb, line 127 def find_all(*args) @path_set.find_all(*args).collect do |template| ::ActionView::Template.new( "Decorated body", template.identifier, template.handler, { :virtual_path => template.virtual_path, :format => template.formats } ) end end
setup()
Link
teardown()
Link
test_controller_appends_view_path_correctly()
Link
# File actionpack/test/controller/view_paths_test.rb, line 48 def test_controller_appends_view_path_correctly @controller.append_view_path 'foo' assert_paths(FIXTURE_LOAD_PATH, "foo") @controller.append_view_path(%w(bar baz)) assert_paths(FIXTURE_LOAD_PATH, "foo", "bar", "baz") @controller.append_view_path(FIXTURE_LOAD_PATH) assert_paths(FIXTURE_LOAD_PATH, "foo", "bar", "baz", FIXTURE_LOAD_PATH) end
test_controller_prepends_view_path_correctly()
Link
# File actionpack/test/controller/view_paths_test.rb, line 59 def test_controller_prepends_view_path_correctly @controller.prepend_view_path 'baz' assert_paths("baz", FIXTURE_LOAD_PATH) @controller.prepend_view_path(%w(foo bar)) assert_paths "foo", "bar", "baz", FIXTURE_LOAD_PATH @controller.prepend_view_path(FIXTURE_LOAD_PATH) assert_paths FIXTURE_LOAD_PATH, "foo", "bar", "baz", FIXTURE_LOAD_PATH end
test_decorate_view_paths_with_custom_resolver()
Link
# File actionpack/test/controller/view_paths_test.rb, line 121 def test_decorate_view_paths_with_custom_resolver decorator_class = Class.new(ActionView::PathResolver) do def initialize(path_set) @path_set = path_set end def find_all(*args) @path_set.find_all(*args).collect do |template| ::ActionView::Template.new( "Decorated body", template.identifier, template.handler, { :virtual_path => template.virtual_path, :format => template.formats } ) end end end decorator = decorator_class.new(TestController.view_paths) TestController.view_paths = ActionView::PathSet.new.push(decorator) get :hello_world assert_response :success assert_equal "Decorated body", @response.body end
test_inheritance()
Link
# File actionpack/test/controller/view_paths_test.rb, line 150 def test_inheritance original_load_paths = ActionController::Base.view_paths self.class.class_eval %Q{ class A < ActionController::Base; end class B < A; end class C < ActionController::Base; end } A.view_paths = ['a/path'] assert_paths A, "a/path" assert_paths A, *B.view_paths assert_paths C, *original_load_paths C.view_paths = [] assert_nothing_raised { C.append_view_path 'c/path' } assert_paths C, "c/path" end
test_lookup_context_accessor()
Link
test_template_appends_view_path_correctly()
Link
# File actionpack/test/controller/view_paths_test.rb, line 70 def test_template_appends_view_path_correctly @controller.instance_variable_set :@template, ActionView::Base.new(TestController.view_paths, {}, @controller) class_view_paths = TestController.view_paths @controller.append_view_path 'foo' assert_paths FIXTURE_LOAD_PATH, "foo" @controller.append_view_path(%w(bar baz)) assert_paths FIXTURE_LOAD_PATH, "foo", "bar", "baz" assert_paths TestController, *class_view_paths end
test_template_load_path_was_set_correctly()
Link
test_template_prepends_view_path_correctly()
Link
# File actionpack/test/controller/view_paths_test.rb, line 82 def test_template_prepends_view_path_correctly @controller.instance_variable_set :@template, ActionView::Base.new(TestController.view_paths, {}, @controller) class_view_paths = TestController.view_paths @controller.prepend_view_path 'baz' assert_paths "baz", FIXTURE_LOAD_PATH @controller.prepend_view_path(%w(foo bar)) assert_paths "foo", "bar", "baz", FIXTURE_LOAD_PATH assert_paths TestController, *class_view_paths end
test_view_paths()
Link
test_view_paths_override()
Link
test_view_paths_override_at_request_time()
Link
test_view_paths_override_for_layouts_in_controllers_with_a_module()
Link
# File actionpack/test/controller/view_paths_test.rb, line 107 def test_view_paths_override_for_layouts_in_controllers_with_a_module @controller = Test::SubController.new Test::SubController.view_paths = [ "#{FIXTURE_LOAD_PATH}/override", FIXTURE_LOAD_PATH, "#{FIXTURE_LOAD_PATH}/override2" ] get :hello_world assert_response :success assert_equal "layout: Hello overridden world!", @response.body end