diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-07 20:29:50 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-07 20:29:50 +0000 |
commit | e1140f876ef2f2760753f681564cb025292c86f0 (patch) | |
tree | b8fcb0361cd72f36b404a9fc52a213f7c7a8f298 /activesupport/test | |
parent | 66b92abfc374e7abec71e0e9facee1128c2657da (diff) | |
download | rails-e1140f876ef2f2760753f681564cb025292c86f0.tar.gz rails-e1140f876ef2f2760753f681564cb025292c86f0.tar.bz2 rails-e1140f876ef2f2760753f681564cb025292c86f0.zip |
Update failing autoload tests.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5463 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/dependencies_test.rb | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index 04fcea2411..813574431e 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -633,25 +633,33 @@ class DependenciesTest < Test::Unit::TestCase end end - def test_autoload_doesnt_shadow_no_method_error + def test_autoload_doesnt_shadow_no_method_error_with_relative_constant with_loading 'autoloading_fixtures' do - assert !defined?(RaisesNoMethodError) + assert !defined?(::RaisesNoMethodError), "::RaisesNoMethodError is defined but it hasn't been referenced yet!" 2.times do assert_raise(NoMethodError) { RaisesNoMethodError } - assert !defined?(RaisesNoMethodError) + assert !defined?(::RaisesNoMethodError), "::RaisesNoMethodError is defined but it should have failed!" end + end + + Object.send(:remove_const, :RaisesNoMethodError) if defined?(::RaisesNoMethodError) + end - assert !defined?(::RaisesNoMethodError) + def test_autoload_doesnt_shadow_no_method_error_with_absolute_constant + with_loading 'autoloading_fixtures' do + assert !defined?(::RaisesNoMethodError), "::RaisesNoMethodError is defined but it hasn't been referenced yet!" 2.times do assert_raise(NoMethodError) { ::RaisesNoMethodError } - assert !defined?(::RaisesNoMethodError) + assert !defined?(::RaisesNoMethodError), "::RaisesNoMethodError is defined but it should have failed!" end end + + Object.send(:remove_const, :RaisesNoMethodError) if defined?(::RaisesNoMethodError) end def test_autoload_doesnt_shadow_name_error with_loading 'autoloading_fixtures' do - assert !defined?(::RaisesNameError) + assert !defined?(::RaisesNameError), "::RaisesNameError is defined but it hasn't been referenced yet!" 2.times do begin ::RaisesNameError.object_id @@ -659,14 +667,16 @@ class DependenciesTest < Test::Unit::TestCase rescue NameError => e assert_equal 'uninitialized constant RaisesNameError::FooBarBaz', e.message end - assert !defined?(::RaisesNameError) + assert !defined?(::RaisesNameError), "::RaisesNameError is defined but it should have failed!" end assert !defined?(RaisesNameError) 2.times do assert_raise(NameError) { RaisesNameError } - assert !defined?(RaisesNameError) + assert !defined?(::RaisesNameError), "::RaisesNameError is defined but it should have failed!" end end + + Object.send(:remove_const, :RaisesNameError) if defined?(::RaisesNameError) end end |