aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-10-16 20:09:42 -0600
committerSean Griffin <sean@thoughtbot.com>2014-10-16 20:09:42 -0600
commite01a46f1f0e21d9018906a6a8dcfdae2d92f32ae (patch)
treeb9daeede0740a4a0f05707479adfd789776ea126 /activerecord/test
parent056d06627af1c99647d88521557c65ddc476520f (diff)
downloadrails-e01a46f1f0e21d9018906a6a8dcfdae2d92f32ae.tar.gz
rails-e01a46f1f0e21d9018906a6a8dcfdae2d92f32ae.tar.bz2
rails-e01a46f1f0e21d9018906a6a8dcfdae2d92f32ae.zip
Add a deprecation warning for abiguous boolean values
In Rails 5.0, we'd like to change the behavior of boolean columns in Rails to be closer to Ruby's semantics. Currently we have a small set of values which are "truthy", and all others are "falsy". In Rails 5.0, we will reverse this to have a small number of values which are "falsy", and all others will become "truthy". In the interim, all values which are ambiguous must emit a deprecation warning.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/types_test.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/activerecord/test/cases/types_test.rb b/activerecord/test/cases/types_test.rb
index db4f78d354..25e6549072 100644
--- a/activerecord/test/cases/types_test.rb
+++ b/activerecord/test/cases/types_test.rb
@@ -29,10 +29,12 @@ module ActiveRecord
assert_equal false, type.type_cast_from_user('FALSE')
assert_equal false, type.type_cast_from_user('off')
assert_equal false, type.type_cast_from_user('OFF')
- assert_equal false, type.type_cast_from_user(' ')
- assert_equal false, type.type_cast_from_user("\u3000\r\n")
- assert_equal false, type.type_cast_from_user("\u0000")
- assert_equal false, type.type_cast_from_user('SOMETHING RANDOM')
+ assert_deprecated do
+ assert_equal false, type.type_cast_from_user(' ')
+ assert_equal false, type.type_cast_from_user("\u3000\r\n")
+ assert_equal false, type.type_cast_from_user("\u0000")
+ assert_equal false, type.type_cast_from_user('SOMETHING RANDOM')
+ end
end
def test_type_cast_integer