diff options
author | Dylan Smith <Dylan.Smith@shopify.com> | 2013-02-06 13:19:09 -0500 |
---|---|---|
committer | Dylan Smith <Dylan.Smith@shopify.com> | 2013-02-07 05:02:38 -0500 |
commit | 04c2d2e2e4197a1564c33f09d3e52253d845925f (patch) | |
tree | c57b23a3197d773dcce73a322806f49833208dbf /activerecord/test/cases/relation | |
parent | b4f189a162f4280b360dbc2a6635bbff6c6f09bc (diff) | |
download | rails-04c2d2e2e4197a1564c33f09d3e52253d845925f.tar.gz rails-04c2d2e2e4197a1564c33f09d3e52253d845925f.tar.bz2 rails-04c2d2e2e4197a1564c33f09d3e52253d845925f.zip |
active_record: Quote numeric values compared to string columns.
Diffstat (limited to 'activerecord/test/cases/relation')
-rw-r--r-- | activerecord/test/cases/relation/where_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb index 80158332f9..0529945532 100644 --- a/activerecord/test/cases/relation/where_test.rb +++ b/activerecord/test/cases/relation/where_test.rb @@ -35,5 +35,30 @@ module ActiveRecord def test_where_with_empty_hash_and_no_foreign_key assert_equal 0, Edge.where(:sink => {}).count end + + def test_where_with_integer_for_string_column + count = Post.where(:title => 0).count + assert_equal 0, count + end + + def test_where_with_float_for_string_column + count = Post.where(:title => 0.0).count + assert_equal 0, count + end + + def test_where_with_boolean_for_string_column + count = Post.where(:title => false).count + assert_equal 0, count + end + + def test_where_with_decimal_for_string_column + count = Post.where(:title => BigDecimal.new(0)).count + assert_equal 0, count + end + + def test_where_with_duration_for_string_column + count = Post.where(:title => 0.seconds).count + assert_equal 0, count + end end end |