Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
on and ON are type casted to a true boolean column
- Loading branch information
1 parent
ffc8e59
commit fc74a51
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |