aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/module_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb
index a24f013d4f..d4ce81fdfa 100644
--- a/activesupport/test/core_ext/module_test.rb
+++ b/activesupport/test/core_ext/module_test.rb
@@ -27,6 +27,8 @@ module Yz
end
Somewhere = Struct.new(:street, :city) do
+ attr_accessor :name
+
protected
def protected_method
@@ -40,6 +42,7 @@ end
class Someone < Struct.new(:name, :place)
delegate :street, :city, :to_f, :protected_method, :private_method, :to => :place
+ delegate :name=, :to => :place, :prefix => true
delegate :upcase, :to => "place.city"
FAILED_DELEGATE_LINE = __LINE__ + 1
@@ -85,6 +88,11 @@ class ModuleTest < Test::Unit::TestCase
assert_equal "Chicago", @david.city
end
+ def test_delegation_to_assignment_method
+ @david.place_name = "Fred"
+ assert_equal "Fred", @david.place.name
+ end
+
def test_delegation_to_protected_method
assert_raise(NoMethodError) { @david.protected_method }
end