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
54117b6
commit 16c4cb0
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 |
16c4cb0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record: @tenderlove measured the performance https://gist.github.com/1597744
16c4cb0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tykcpcp;;ccifgioixksaauud sajasodcv ascl k mwsdm cnfkvkfvjkikvkc ck.of ld kdkd jki kofcdsdo dfqfijn okdfvo3ekw ifieriir