diff options
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/delegation.rb | 6 | ||||
-rw-r--r-- | activesupport/test/core_ext/module_test.rb | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb index 9d4b78e242..1aa72da743 100644 --- a/activesupport/lib/active_support/core_ext/module/delegation.rb +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb @@ -1,4 +1,8 @@ class Module + # Error generated by +delegate+ when a method is called on +nil+ and +allow_nil+ + # option is not used. + class DelegationError < NoMethodError; end + # Provides a +delegate+ class method to easily expose contained objects' # public methods as your own. # @@ -194,5 +198,3 @@ class Module end end end - -class DelegationError < StandardError ; end diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index ecef7754aa..f08c61ae92 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -207,7 +207,7 @@ class ModuleTest < ActiveSupport::TestCase def test_delegation_without_allow_nil_and_nil_value david = Someone.new("David") - assert_raise(DelegationError) { david.street } + assert_raise(Module::DelegationError) { david.street } end def test_delegation_to_method_that_exists_on_nil |