diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-11 23:13:54 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-11 23:26:32 -0200 |
commit | fc74a51c3fd51d33fb4891a1f0c8d4571a776905 (patch) | |
tree | ce012763a7ee7e68848e980892d6b9f8b9911a76 /activerecord/test | |
parent | ffc8e59e8bfa08672732553200868070e82d220c (diff) | |
download | rails-fc74a51c3fd51d33fb4891a1f0c8d4571a776905.tar.gz rails-fc74a51c3fd51d33fb4891a1f0c8d4571a776905.tar.bz2 rails-fc74a51c3fd51d33fb4891a1f0c8d4571a776905.zip |
on and ON are type casted to a true boolean column
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/column_test.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/activerecord/test/cases/column_test.rb b/activerecord/test/cases/column_test.rb new file mode 100644 index 0000000000..ccc57cb876 --- /dev/null +++ b/activerecord/test/cases/column_test.rb @@ -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 |