diff options
author | Daniel Schierbeck <daniel.schierbeck@gmail.com> | 2008-09-23 22:42:36 +0200 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-11-21 01:15:49 +0530 |
commit | a5156d9c2c3fe63f8b6a352199e51544ae28876a (patch) | |
tree | d6953be244d9c698b6bb638cafc2b58a645e03ad /activesupport/test | |
parent | 206c5643aae40b0884d42fdb8caeb3f763936fa9 (diff) | |
download | rails-a5156d9c2c3fe63f8b6a352199e51544ae28876a.tar.gz rails-a5156d9c2c3fe63f8b6a352199e51544ae28876a.tar.bz2 rails-a5156d9c2c3fe63f8b6a352199e51544ae28876a.zip |
Ensure only delegations to methods can have an automatic prefix. [#1235 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/module_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index 7fe5d0faee..886f692499 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -106,6 +106,17 @@ class ModuleTest < Test::Unit::TestCase assert_equal invoice.customer_city, "Chicago" end + def test_delegation_prefix_with_instance_variable + assert_raise ArgumentError do + Class.new do + def initialize(client) + @client = client + end + delegate :name, :address, :to => :@client, :prefix => true + end + end + end + def test_parent assert_equal Yz::Zy, Yz::Zy::Cd.parent assert_equal Yz, Yz::Zy.parent |