diff options
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/name_error_test.rb | 4 | ||||
-rw-r--r-- | activesupport/test/dependencies_test.rb | 27 |
2 files changed, 29 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/name_error_test.rb b/activesupport/test/core_ext/name_error_test.rb index 13910d2e01..e49b88eb38 100644 --- a/activesupport/test/core_ext/name_error_test.rb +++ b/activesupport/test/core_ext/name_error_test.rb @@ -8,9 +8,9 @@ class NameErrorTest < Test::Unit::TestCase SomeNameThatNobodyWillUse____Really ? 1 : 0 flunk "?!?!" rescue NameError => exc - assert_equal "SomeNameThatNobodyWillUse____Really", exc.missing_name + assert_equal "NameErrorTest::SomeNameThatNobodyWillUse____Really", exc.missing_name assert exc.missing_name?(:SomeNameThatNobodyWillUse____Really) - assert exc.missing_name?("SomeNameThatNobodyWillUse____Really") + assert exc.missing_name?("NameErrorTest::SomeNameThatNobodyWillUse____Really") end end diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index 397548973a..f19542bdb0 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -155,4 +155,31 @@ class DependenciesTest < Test::Unit::TestCase Object.send :remove_const, :ModuleFolder end end + + def test_non_existing_const_raises_name_error_with_fully_qualified_name + with_loading 'autoloading_fixtures' do + begin + A::DoesNotExist + flunk "No raise!!" + rescue NameError => e + assert_equal "uninitialized constant A::DoesNotExist", e.message + end + begin + A::B::DoesNotExist + flunk "No raise!!" + rescue NameError => e + assert_equal "uninitialized constant A::B::DoesNotExist", e.message + end + end + end + + def test_smart_name_error_strings + begin + Object.module_eval "ImaginaryObject" + flunk "No raise!!" + rescue NameError => e + assert e.message.include?("uninitialized constant ImaginaryObject") + end + end + end |