提交 199d4e28 编写于 作者: Y yui-knk

Add tests for sanitize named bind arity

上级 9f23ee0f
......@@ -701,12 +701,12 @@ def test_named_bind_variables_with_quotes
end
def test_bind_arity
assert_nothing_raised { bind '' }
assert_nothing_raised { bind '' }
assert_raise(ActiveRecord::PreparedStatementInvalid) { bind '', 1 }
assert_raise(ActiveRecord::PreparedStatementInvalid) { bind '?' }
assert_nothing_raised { bind '?', 1 }
assert_raise(ActiveRecord::PreparedStatementInvalid) { bind '?', 1, 1 }
assert_nothing_raised { bind '?', 1 }
assert_raise(ActiveRecord::PreparedStatementInvalid) { bind '?', 1, 1 }
end
def test_named_bind_variables
......@@ -721,6 +721,12 @@ def test_named_bind_variables
assert_kind_of Time, Topic.where(["id = :id", { id: 1 }]).first.written_on
end
def test_named_bind_arity
assert_nothing_raised { bind "name = :name", { name: "37signals" } }
assert_nothing_raised { bind "name = :name", { name: "37signals", id: 1 } }
assert_raise(ActiveRecord::PreparedStatementInvalid) { bind "name = :name", { id: 1 } }
end
class SimpleEnumerable
include Enumerable
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册