提交 8b07f185 编写于 作者: S Sean Griffin

Stop explicitly passing `nil` as the column to `type_cast`

So we can change the arity later.
上级 667b3ef8
...@@ -21,46 +21,46 @@ def test_type_cast_binary_encoding_without_logger ...@@ -21,46 +21,46 @@ def test_type_cast_binary_encoding_without_logger
end end
def test_type_cast_symbol def test_type_cast_symbol
assert_equal 'foo', @conn.type_cast(:foo, nil) assert_equal 'foo', @conn.type_cast(:foo)
end end
def test_type_cast_date def test_type_cast_date
date = Date.today date = Date.today
expected = @conn.quoted_date(date) expected = @conn.quoted_date(date)
assert_equal expected, @conn.type_cast(date, nil) assert_equal expected, @conn.type_cast(date)
end end
def test_type_cast_time def test_type_cast_time
time = Time.now time = Time.now
expected = @conn.quoted_date(time) expected = @conn.quoted_date(time)
assert_equal expected, @conn.type_cast(time, nil) assert_equal expected, @conn.type_cast(time)
end end
def test_type_cast_numeric def test_type_cast_numeric
assert_equal 10, @conn.type_cast(10, nil) assert_equal 10, @conn.type_cast(10)
assert_equal 2.2, @conn.type_cast(2.2, nil) assert_equal 2.2, @conn.type_cast(2.2)
end end
def test_type_cast_nil def test_type_cast_nil
assert_equal nil, @conn.type_cast(nil, nil) assert_equal nil, @conn.type_cast(nil)
end end
def test_type_cast_true def test_type_cast_true
assert_equal 't', @conn.type_cast(true, nil) assert_equal 't', @conn.type_cast(true)
end end
def test_type_cast_false def test_type_cast_false
assert_equal 'f', @conn.type_cast(false, nil) assert_equal 'f', @conn.type_cast(false)
end end
def test_type_cast_bigdecimal def test_type_cast_bigdecimal
bd = BigDecimal.new '10.0' bd = BigDecimal.new '10.0'
assert_equal bd.to_f, @conn.type_cast(bd, nil) assert_equal bd.to_f, @conn.type_cast(bd)
end end
def test_type_cast_unknown_should_raise_error def test_type_cast_unknown_should_raise_error
obj = Class.new.new obj = Class.new.new
assert_raise(TypeError) { @conn.type_cast(obj, nil) } assert_raise(TypeError) { @conn.type_cast(obj) }
end end
def test_type_cast_object_which_responds_to_quoted_id def test_type_cast_object_which_responds_to_quoted_id
...@@ -73,14 +73,14 @@ def id ...@@ -73,14 +73,14 @@ def id
10 10
end end
}.new }.new
assert_equal 10, @conn.type_cast(quoted_id_obj, nil) assert_equal 10, @conn.type_cast(quoted_id_obj)
quoted_id_obj = Class.new { quoted_id_obj = Class.new {
def quoted_id def quoted_id
"'zomg'" "'zomg'"
end end
}.new }.new
assert_raise(TypeError) { @conn.type_cast(quoted_id_obj, nil) } assert_raise(TypeError) { @conn.type_cast(quoted_id_obj) }
end end
def test_quoting_binary_strings def test_quoting_binary_strings
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册