提交 ad53b684 编写于 作者: P Peter Wagenet 提交者: wycats

Class Attribute setter returns set value

Signed-off-by: Nwycats <wycats@gmail.com>
上级 fb6b8056
......@@ -72,6 +72,7 @@ def self.#{name}=(val)
remove_possible_method(:#{name})
define_method(:#{name}) { val }
end
val
end
def #{name}
......
......@@ -65,4 +65,9 @@ def setup
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册