Mercurial > hg > soundsoftware-site
annotate .svn/pristine/c4/c4b62ae1f4f01307776331aad68b547e24878c12.svn-base @ 1327:287f201c2802 redmine-2.2-integration
Add italic
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Wed, 19 Jun 2013 20:56:22 +0100 |
parents | cbb26bc654de |
children |
rev | line source |
---|---|
Chris@909 | 1 require File.dirname(__FILE__) + '/../test_helper' |
Chris@909 | 2 |
Chris@909 | 3 class ModelAndLibTest < Test::Unit::TestCase |
Chris@909 | 4 |
Chris@909 | 5 def test_WITH_a_model_defined_only_in_a_plugin_IT_should_load_the_model |
Chris@909 | 6 assert_equal 'AlphaPluginModel (from alpha_plugin)', AlphaPluginModel.report_location |
Chris@909 | 7 end |
Chris@909 | 8 |
Chris@909 | 9 def test_WITH_a_model_defined_only_in_a_plugin_lib_dir_IT_should_load_the_model |
Chris@909 | 10 assert_equal 'AlphaPluginLibModel (from alpha_plugin)', AlphaPluginLibModel.report_location |
Chris@909 | 11 end |
Chris@909 | 12 |
Chris@909 | 13 # app takes precedence over plugins |
Chris@909 | 14 |
Chris@909 | 15 def test_WITH_a_model_defined_in_both_app_and_plugin_IT_should_load_the_one_in_app |
Chris@909 | 16 assert_equal 'AppAndPluginModel (from app)', AppAndPluginModel.report_location |
Chris@909 | 17 assert_raises(NoMethodError) { AppAndPluginLibModel.defined_only_in_alpha_engine_version } |
Chris@909 | 18 end |
Chris@909 | 19 |
Chris@909 | 20 def test_WITH_a_model_defined_in_both_app_and_plugin_lib_dirs_IT_should_load_the_one_in_app |
Chris@909 | 21 assert_equal 'AppAndPluginLibModel (from lib)', AppAndPluginLibModel.report_location |
Chris@909 | 22 assert_raises(NoMethodError) { AppAndPluginLibModel.defined_only_in_alpha_engine_version } |
Chris@909 | 23 end |
Chris@909 | 24 |
Chris@909 | 25 # subsequently loaded plugins take precendence over previously loaded plugins |
Chris@909 | 26 |
Chris@909 | 27 # TODO |
Chris@909 | 28 # |
Chris@909 | 29 # this does work when we rely on $LOAD_PATH while it won't work when we use |
Chris@909 | 30 # Dependency constant autoloading. This somewhat confusing difference has |
Chris@909 | 31 # been there since at least Rails 1.2.x. See http://www.ruby-forum.com/topic/134529 |
Chris@909 | 32 |
Chris@909 | 33 def test_WITH_a_model_defined_in_two_plugins_IT_should_load_the_latter_of_both |
Chris@909 | 34 require 'shared_plugin_model' |
Chris@909 | 35 assert_equal SharedPluginModel.report_location, 'SharedPluginModel (from beta_plugin)' |
Chris@909 | 36 end |
Chris@909 | 37 end |