Permalink
Browse files

Class Attribute setter returns set value

Signed-off-by: wycats <wycats@gmail.com>
  • Loading branch information...
1 parent fb6b805 commit ad53b68457af0f3c4e875309f298335a17b9029c @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 ad53b68

Please sign in to comment.