aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-08-05 22:52:15 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-08-05 22:52:15 +0000
commit52d4166947d94a3648f1531239491f51cd73f2de (patch)
treec78fbaff7f9c194ba077f0f5303c4cd973973f87 /activesupport/test
parent6ba4f4c524f73db062016701c9f93c70b08d93c0 (diff)
downloadrails-52d4166947d94a3648f1531239491f51cd73f2de.tar.gz
rails-52d4166947d94a3648f1531239491f51cd73f2de.tar.bz2
rails-52d4166947d94a3648f1531239491f51cd73f2de.zip
Raise fully qualified names upon name errors. Closes #5533.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/name_error_test.rb4
-rw-r--r--activesupport/test/dependencies_test.rb27
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