annotate vendor/plugins/engines/test/functional/view_loading_test.rb @ 904:0a8317a50fa0 redmine-1.1

Close obsolete branch redmine-1.1
author Chris Cannam
date Fri, 14 Jan 2011 12:53:21 +0000
parents 513646585e45
children
rev   line source
Chris@0 1 # Tests in this file ensure that:
Chris@0 2 #
Chris@0 3 # * plugin views are found
Chris@0 4 # * views in the application take precedence over those in plugins
Chris@0 5 # * views in subsequently loaded plugins take precendence over those in previously loaded plugins
Chris@0 6 # * this works for namespaced views accordingly
Chris@0 7
Chris@0 8 require File.dirname(__FILE__) + '/../test_helper'
Chris@0 9
Chris@0 10 class ViewLoadingTest < ActionController::TestCase
Chris@0 11 def setup
Chris@0 12 @request = ActionController::TestRequest.new
Chris@0 13 @response = ActionController::TestResponse.new
Chris@0 14 end
Chris@0 15
Chris@0 16 # plugin views should be found
Chris@0 17
Chris@0 18 def test_WITH_a_view_defined_only_in_a_plugin_IT_should_find_the_view
Chris@0 19 get_action_on_controller :a_view, :alpha_plugin
Chris@0 20 assert_response_body 'alpha_plugin/a_view'
Chris@0 21 end
Chris@0 22
Chris@0 23 def test_WITH_a_namespaced_view_defined_only_in_a_plugin_IT_should_find_the_view
Chris@0 24 get_action_on_controller :a_view, :alpha_plugin, :namespace
Chris@0 25 assert_response_body 'namespace/alpha_plugin/a_view'
Chris@0 26 end
Chris@0 27
Chris@0 28 # app takes precedence over plugins
Chris@0 29
Chris@0 30 def test_WITH_a_view_defined_in_both_app_and_plugin_IT_should_find_the_one_in_app
Chris@0 31 get_action_on_controller :a_view, :app_and_plugin
Chris@0 32 assert_response_body 'app_and_plugin/a_view (from app)'
Chris@0 33 end
Chris@0 34
Chris@0 35 def test_WITH_a_namespaced_view_defined_in_both_app_and_plugin_IT_should_find_the_one_in_app
Chris@0 36 get_action_on_controller :a_view, :app_and_plugin, :namespace
Chris@0 37 assert_response_body 'namespace/app_and_plugin/a_view (from app)'
Chris@0 38 end
Chris@0 39
Chris@0 40 # subsequently loaded plugins take precendence over previously loaded plugins
Chris@0 41
Chris@0 42 def test_WITH_a_view_defined_in_two_plugins_IT_should_find_the_latter_of_both
Chris@0 43 get_action_on_controller :a_view, :shared_plugin
Chris@0 44 assert_response_body 'shared_plugin/a_view (from beta_plugin)'
Chris@0 45 end
Chris@0 46
Chris@0 47 def test_WITH_a_namespaced_view_defined_in_two_plugins_IT_should_find_the_latter_of_both
Chris@0 48 get_action_on_controller :a_view, :shared_plugin, :namespace
Chris@0 49 assert_response_body 'namespace/shared_plugin/a_view (from beta_plugin)'
Chris@0 50 end
Chris@0 51
Chris@0 52 # layouts loaded from plugins
Chris@0 53
Chris@0 54 def test_should_be_able_to_load_a_layout_from_a_plugin
Chris@0 55 get_action_on_controller :action_with_layout, :alpha_plugin
Chris@0 56 assert_response_body 'rendered in AlphaPluginController#action_with_layout (with plugin layout)'
Chris@0 57 end
Chris@0 58
Chris@0 59 end
Chris@0 60