diff options
author | Xavier Noria <fxn@hashref.com> | 2013-06-14 02:19:25 -0700 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2013-06-14 02:19:25 -0700 |
commit | 85bb7d9af16dafccd3c3d2394a75050951f8804c (patch) | |
tree | bad591f0a7c1b59ee39cb51f7d25972ab768ee8d /activesupport/test | |
parent | 90a6059dd2df748e002618eaacab6b46f50d4bfc (diff) | |
parent | 7fd36f307a86b64d05f9171ff050c4af3b45725c (diff) | |
download | rails-85bb7d9af16dafccd3c3d2394a75050951f8804c.tar.gz rails-85bb7d9af16dafccd3c3d2394a75050951f8804c.tar.bz2 rails-85bb7d9af16dafccd3c3d2394a75050951f8804c.zip |
Merge pull request #10943 from killthekitten/10932_constantize_empty
Fix #10932. Treat "" and "::" as invalid on constantize
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/constantize_test_cases.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activesupport/test/constantize_test_cases.rb b/activesupport/test/constantize_test_cases.rb index 9b62295c96..bbeb710a0c 100644 --- a/activesupport/test/constantize_test_cases.rb +++ b/activesupport/test/constantize_test_cases.rb @@ -34,8 +34,6 @@ module ConstantizeTestCases assert_equal Case::Dice, yield("Object::Case::Dice") assert_equal ConstantizeTestCases, yield("ConstantizeTestCases") assert_equal ConstantizeTestCases, yield("::ConstantizeTestCases") - assert_equal Object, yield("") - assert_equal Object, yield("::") assert_raises(NameError) { yield("UnknownClass") } assert_raises(NameError) { yield("UnknownClass::Ace") } assert_raises(NameError) { yield("UnknownClass::Ace::Base") } @@ -45,6 +43,8 @@ module ConstantizeTestCases assert_raises(NameError) { yield("Ace::Base::ConstantizeTestCases") } assert_raises(NameError) { yield("Ace::Gas::Base") } assert_raises(NameError) { yield("Ace::Gas::ConstantizeTestCases") } + assert_raises(NameError) { yield("") } + assert_raises(NameError) { yield("::") } end def run_safe_constantize_tests_on @@ -58,8 +58,8 @@ module ConstantizeTestCases assert_equal Case::Dice, yield("Object::Case::Dice") assert_equal ConstantizeTestCases, yield("ConstantizeTestCases") assert_equal ConstantizeTestCases, yield("::ConstantizeTestCases") - assert_equal Object, yield("") - assert_equal Object, yield("::") + assert_nil yield("") + assert_nil yield("::") assert_nil yield("UnknownClass") assert_nil yield("UnknownClass::Ace") assert_nil yield("UnknownClass::Ace::Base") |