blob: ccc57cb87678595a97e5d901c8e0d49349f78ca4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
require "cases/helper"
module ActiveRecord
module ConnectionAdapters
class ColumnTest < ActiveRecord::TestCase
def test_type_cast_boolean
column = Column.new("field", nil, "boolean")
assert column.type_cast(true)
assert column.type_cast(1)
assert column.type_cast('1')
assert column.type_cast('t')
assert column.type_cast('T')
assert column.type_cast('true')
assert column.type_cast('TRUE')
assert column.type_cast('on')
assert column.type_cast('ON')
assert !column.type_cast(false)
assert !column.type_cast(0)
assert !column.type_cast('0')
assert !column.type_cast('f')
assert !column.type_cast('F')
assert !column.type_cast('false')
assert !column.type_cast('FALSE')
assert !column.type_cast('off')
assert !column.type_cast('OFF')
end
end
end
end
|