diff options
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/class/attribute.rb | 1 | ||||
-rw-r--r-- | activesupport/test/core_ext/class/attribute_test.rb | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/attribute.rb b/activesupport/lib/active_support/core_ext/class/attribute.rb index 79d5c40e5f..688cba03db 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute.rb @@ -72,6 +72,7 @@ class Class remove_possible_method(:#{name}) define_method(:#{name}) { val } end + val end def #{name} diff --git a/activesupport/test/core_ext/class/attribute_test.rb b/activesupport/test/core_ext/class/attribute_test.rb index 24aa5c0eba..d58b60482b 100644 --- a/activesupport/test/core_ext/class/attribute_test.rb +++ b/activesupport/test/core_ext/class/attribute_test.rb @@ -65,4 +65,9 @@ class ClassAttributeTest < ActiveSupport::TestCase object.singleton_class.setting = 'foo' assert_equal 'foo', object.setting end + + test 'setter returns set value' do + val = @klass.send(:setting=, 1) + assert_equal 1, val + end end |