Class: ModelAndLibTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- ModelAndLibTest
- Defined in:
- vendor/plugins/engines/test/unit/model_and_lib_test.rb
Instance Method Summary
-
- (Object) test_WITH_a_model_defined_in_both_app_and_plugin_IT_should_load_the_one_in_app
app takes precedence over plugins.
- - (Object) test_WITH_a_model_defined_in_both_app_and_plugin_lib_dirs_IT_should_load_the_one_in_app
-
- (Object) test_WITH_a_model_defined_in_two_plugins_IT_should_load_the_latter_of_both
TODO.
- - (Object) test_WITH_a_model_defined_only_in_a_plugin_IT_should_load_the_model
- - (Object) test_WITH_a_model_defined_only_in_a_plugin_lib_dir_IT_should_load_the_model
Instance Method Details
- (Object) test_WITH_a_model_defined_in_both_app_and_plugin_IT_should_load_the_one_in_app
app takes precedence over plugins
15 16 17 18 |
# File 'vendor/plugins/engines/test/unit/model_and_lib_test.rb', line 15 def test_WITH_a_model_defined_in_both_app_and_plugin_IT_should_load_the_one_in_app assert_equal 'AppAndPluginModel (from app)', AppAndPluginModel.report_location assert_raises(NoMethodError) { AppAndPluginLibModel.defined_only_in_alpha_engine_version } end |
- (Object) test_WITH_a_model_defined_in_both_app_and_plugin_lib_dirs_IT_should_load_the_one_in_app
20 21 22 23 |
# File 'vendor/plugins/engines/test/unit/model_and_lib_test.rb', line 20 def test_WITH_a_model_defined_in_both_app_and_plugin_lib_dirs_IT_should_load_the_one_in_app assert_equal 'AppAndPluginLibModel (from lib)', AppAndPluginLibModel.report_location assert_raises(NoMethodError) { AppAndPluginLibModel.defined_only_in_alpha_engine_version } end |
- (Object) test_WITH_a_model_defined_in_two_plugins_IT_should_load_the_latter_of_both
TODO
this does work when we rely on $LOAD_PATH while it won’t work when we use Dependency constant autoloading. This somewhat confusing difference has been there since at least Rails 1.2.x. See http://www.ruby-forum.com/topic/134529
33 34 35 36 |
# File 'vendor/plugins/engines/test/unit/model_and_lib_test.rb', line 33 def test_WITH_a_model_defined_in_two_plugins_IT_should_load_the_latter_of_both require 'shared_plugin_model' assert_equal SharedPluginModel.report_location, 'SharedPluginModel (from beta_plugin)' end |
- (Object) test_WITH_a_model_defined_only_in_a_plugin_IT_should_load_the_model
5 6 7 |
# File 'vendor/plugins/engines/test/unit/model_and_lib_test.rb', line 5 def test_WITH_a_model_defined_only_in_a_plugin_IT_should_load_the_model assert_equal 'AlphaPluginModel (from alpha_plugin)', AlphaPluginModel.report_location end |
- (Object) test_WITH_a_model_defined_only_in_a_plugin_lib_dir_IT_should_load_the_model
9 10 11 |
# File 'vendor/plugins/engines/test/unit/model_and_lib_test.rb', line 9 def test_WITH_a_model_defined_only_in_a_plugin_lib_dir_IT_should_load_the_model assert_equal 'AlphaPluginLibModel (from alpha_plugin)', AlphaPluginLibModel.report_location end |