Mercurial > hg > soundsoftware-site
diff .svn/pristine/f7/f767b8d14c7249c0fabe9ba271f45b37cfcab811.svn-base @ 909:cbb26bc654de redmine-1.3
Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author | Chris Cannam |
---|---|
date | Fri, 24 Feb 2012 19:09:32 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.svn/pristine/f7/f767b8d14c7249c0fabe9ba271f45b37cfcab811.svn-base Fri Feb 24 19:09:32 2012 +0000 @@ -0,0 +1,60 @@ +# Tests in this file ensure that: +# +# * plugin views are found +# * views in the application take precedence over those in plugins +# * views in subsequently loaded plugins take precendence over those in previously loaded plugins +# * this works for namespaced views accordingly + +require File.dirname(__FILE__) + '/../test_helper' + +class ViewLoadingTest < ActionController::TestCase + def setup + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + # plugin views should be found + + def test_WITH_a_view_defined_only_in_a_plugin_IT_should_find_the_view + get_action_on_controller :a_view, :alpha_plugin + assert_response_body 'alpha_plugin/a_view' + end + + def test_WITH_a_namespaced_view_defined_only_in_a_plugin_IT_should_find_the_view + get_action_on_controller :a_view, :alpha_plugin, :namespace + assert_response_body 'namespace/alpha_plugin/a_view' + end + + # app takes precedence over plugins + + def test_WITH_a_view_defined_in_both_app_and_plugin_IT_should_find_the_one_in_app + get_action_on_controller :a_view, :app_and_plugin + assert_response_body 'app_and_plugin/a_view (from app)' + end + + def test_WITH_a_namespaced_view_defined_in_both_app_and_plugin_IT_should_find_the_one_in_app + get_action_on_controller :a_view, :app_and_plugin, :namespace + assert_response_body 'namespace/app_and_plugin/a_view (from app)' + end + + # subsequently loaded plugins take precendence over previously loaded plugins + + def test_WITH_a_view_defined_in_two_plugins_IT_should_find_the_latter_of_both + get_action_on_controller :a_view, :shared_plugin + assert_response_body 'shared_plugin/a_view (from beta_plugin)' + end + + def test_WITH_a_namespaced_view_defined_in_two_plugins_IT_should_find_the_latter_of_both + get_action_on_controller :a_view, :shared_plugin, :namespace + assert_response_body 'namespace/shared_plugin/a_view (from beta_plugin)' + end + + # layouts loaded from plugins + + def test_should_be_able_to_load_a_layout_from_a_plugin + get_action_on_controller :action_with_layout, :alpha_plugin + assert_response_body 'rendered in AlphaPluginController#action_with_layout (with plugin layout)' + end + +end + \ No newline at end of file