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

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

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