Permalink
Browse files

Class Attribute setter returns set value

Signed-off-by: wycats <wycats@gmail.com>
  • Loading branch information...
1 parent 5f5c508 commit b9281e8e2c8a9955d551c0ec6720e9e342443c4b @wagenet wagenet committed with wycats Aug 6, 2010
@@ -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

0 comments on commit b9281e8

Please sign in to comment.