diff options
Diffstat (limited to 'activesupport/test/testing')
-rw-r--r-- | activesupport/test/testing/constant_lookup_test.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/activesupport/test/testing/constant_lookup_test.rb b/activesupport/test/testing/constant_lookup_test.rb index 19280ba74a..0f16419c8b 100644 --- a/activesupport/test/testing/constant_lookup_test.rb +++ b/activesupport/test/testing/constant_lookup_test.rb @@ -1,15 +1,16 @@ require 'abstract_unit' +require 'dependencies_test_helpers' class Foo; end class Bar < Foo def index; end def self.index; end end -class Baz < Bar; end module FooBar; end class ConstantLookupTest < ActiveSupport::TestCase include ActiveSupport::Testing::ConstantLookup + include DependenciesTestHelpers def find_foo(name) self.class.determine_constant_from_test_name(name) do |constant| @@ -56,4 +57,20 @@ class ConstantLookupTest < ActiveSupport::TestCase assert_nil find_module("DoesntExist::Nadda::Nope") assert_nil find_module("DoesntExist::Nadda::Nope::NotHere") end + + def test_does_not_swallow_exception_on_no_method_error + assert_raises(NoMethodError) { + with_autoloading_fixtures { + self.class.determine_constant_from_test_name("RaisesNoMethodError") + } + } + end + + def test_does_not_swallow_exception_on_no_name_error_within_constant + assert_raises(NameError) do + with_autoloading_fixtures do + self.class.determine_constant_from_test_name('RaisesNameError') + end + end + end end |