Changeset 4780
- Timestamp:
- 08/17/06 03:35:36 (2 years ago)
- Files:
-
- trunk/activesupport/CHANGELOG (modified) (1 diff)
- trunk/activesupport/lib/active_support/dependencies.rb (modified) (1 diff)
- trunk/activesupport/test/dependencies_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/CHANGELOG
r4774 r4780 1 1 *SVN* 2 3 * Detect missing_constants calls from removed modules and fail accordingly. [Nicholas Seckar] 2 4 3 5 * Stop using defined? in Dependencies.qualified_const_defined? since defined? may invoke const_missing. [Nicholas Seckar] trunk/activesupport/lib/active_support/dependencies.rb
r4779 r4780 182 182 # If we have an anonymous module, all we can do is attempt to load from Object. 183 183 from_mod = Object if from_mod.name.empty? 184 185 unless qualified_const_defined?(from_mod.name) && from_mod.name.constantize.object_id == from_mod.object_id 186 raise ArgumentError, "A copy of #{from_mod} has been removed from the module tree but is still active!" 187 end 184 188 185 189 raise ArgumentError, "Expected #{from_mod} is not missing constant #{const_name}!" if from_mod.const_defined?(const_name) trunk/activesupport/test/dependencies_test.rb
r4779 r4780 373 373 end 374 374 375 def test_removal_from_tree_should_be_detected 376 with_loading 'dependencies' do 377 root = Dependencies.autoload_paths.first 378 c = ServiceOne 379 Dependencies.clear 380 assert ! defined?(ServiceOne) 381 begin 382 Dependencies.load_missing_constant(c, :FakeMissing) 383 flunk "Expected exception" 384 rescue ArgumentError => e 385 assert_match %r{ServiceOne has been removed from the module tree}i, e.message 386 end 387 end 388 end 389 375 390 end