diff options
Diffstat (limited to 'activesupport/test/core_ext/module_test.rb')
-rw-r--r-- | activesupport/test/core_ext/module_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index ae4aed0554..0120aae492 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -83,6 +83,20 @@ Product = Struct.new(:name) do end end +DecoratedTester = Struct.new(:client) do + delegate_missing_to :client +end + +class DecoratedReserved + delegate_missing_to :case + + attr_reader :case + + def initialize(kase) + @case = kase + end +end + class Block def hello? true @@ -316,6 +330,14 @@ class ModuleTest < ActiveSupport::TestCase assert has_block.hello? end + def test_delegate_to_missing_with_method + assert_equal "David", DecoratedTester.new(@david).name + end + + def test_delegate_to_missing_with_reserved_methods + assert_equal "David", DecoratedReserved.new(@david).name + end + def test_parent assert_equal Yz::Zy, Yz::Zy::Cd.parent assert_equal Yz, Yz::Zy.parent |