##// END OF EJS Templates
Swedish translation updated by Nicklas Holm (#10750)...
Swedish translation updated by Nicklas Holm (#10750) git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9523 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r2773:7b0cb6aba871
r9344:34e20c4373b7
Show More
view_loading_test.rb
59 lines | 2.1 KiB | text/x-ruby | RubyLexer
Eric Davis
Upgraded to Rails 2.3.4 (#3597)...
r2773 # 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