diff options
author | Yosuke Kabuto <bluewhale1982@gmail.com> | 2016-05-25 23:42:12 +0900 |
---|---|---|
committer | Yosuke Kabuto <bluewhale1982@gmail.com> | 2016-05-25 23:42:12 +0900 |
commit | 1b98d338762c3addad8133393a6063385ffa6e62 (patch) | |
tree | 75ff30c8a7ef47c74a5ddb0a14d2bcbcbeb8b0d7 | |
parent | bf219714dce494f5b69cb7dd9b8c43a68a4988da (diff) | |
download | rails-1b98d338762c3addad8133393a6063385ffa6e62.tar.gz rails-1b98d338762c3addad8133393a6063385ffa6e62.tar.bz2 rails-1b98d338762c3addad8133393a6063385ffa6e62.zip |
Add tests for keyword arg to: for Module#delegate
-rw-r--r-- | activesupport/test/core_ext/module_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index 75490bf4c9..1f84e11529 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -193,6 +193,21 @@ class ModuleTest < ActiveSupport::TestCase end end + def test_delegation_target_when_prefix_is_true + assert_nothing_raised do + Name.send :delegate, :go, to: :you, prefix: true + end + assert_nothing_raised do + Name.send :delegate, :go, to: :_you, prefix: true + end + assert_raise(ArgumentError) do + Name.send :delegate, :go, to: :You, prefix: true + end + assert_raise(ArgumentError) do + Name.send :delegate, :go, to: :@you, prefix: true + end + end + def test_delegation_prefix invoice = Invoice.new(@david) assert_equal invoice.client_name, "David" |