提交 609b1ec9 编写于 作者: R Ryuta Kamizono

`Persistence#increment!` requires an attribute argument which is incremented

上级 ed56a031
......@@ -318,7 +318,7 @@ def touch(*) #:nodoc:
_run_touch_callbacks { super }
end
def increment!(*, touch: nil) # :nodoc:
def increment!(attribute, by = 1, touch: nil) # :nodoc:
touch ? _run_touch_callbacks { super } : super
end
......
......@@ -127,6 +127,11 @@ def test_increment_with_touch_an_attribute_updates_timestamps
assert_operator previously_written_on, :<, topic.written_on
end
def test_increment_with_no_arg
topic = topics(:first)
assert_raises(ArgumentError) { topic.increment! }
end
def test_destroy_many
clients = Client.find([2, 3])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册