1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases/column_test.rb

30 lines
926 B
Ruby
Raw Normal View History

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