Permalink
Browse files

Update failing autoload tests.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5463 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 66b92ab commit e1140f876ef2f2760753f681564cb025292c86f0 @jeremy jeremy committed Nov 7, 2006
Showing with 18 additions and 8 deletions.
  1. +18 −8 activesupport/test/dependencies_test.rb
View
26 activesupport/test/dependencies_test.rb
@@ -633,40 +633,50 @@ def test_nested_file_with_multiple_constants_and_auto_loading
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
flunk 'should have raised NameError when autoloaded file referenced FooBarBaz'
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

0 comments on commit e1140f8

Please sign in to comment.