From 1cc8ab865fb0b36df1d202ea4d08952d2881d347 Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Wed, 16 Nov 2005 00:56:16 +0000 Subject: Change Inflector#constantize to use eval instead of const_get git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3049 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/test/inflector_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index 995871f826..d92b4a76a8 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -276,6 +276,11 @@ class InflectorTest < Test::Unit::TestCase assert_equal Ace::Base::Case, Inflector.constantize("Ace::Base::Case") assert_equal InflectorTest, Inflector.constantize("InflectorTest") assert_raises(NameError) { Inflector.constantize("UnknownClass") } + assert_raises(NameError) { Inflector.constantize("An invalid string") } + end + + def test_constantize_doesnt_look_in_parent + assert_raises(NameError) { Inflector.constantize("Ace::Base::InflectorTest") } end def test_ordinal -- cgit v1.2.3