diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-02-07 18:45:25 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-02-09 16:58:50 -0800 |
commit | 921a296a3390192a71abeec6d9a035cc6d1865c8 (patch) | |
tree | d7d92531999ece12a1b67c729a7fbe1bed5e96ae /activerecord/test/cases/relation/where_test.rb | |
parent | 746dbd89faf8197e6d6f35f6e428a024923116a2 (diff) | |
download | rails-921a296a3390192a71abeec6d9a035cc6d1865c8.tar.gz rails-921a296a3390192a71abeec6d9a035cc6d1865c8.tar.bz2 rails-921a296a3390192a71abeec6d9a035cc6d1865c8.zip |
Merge pull request #9208 from dylanahsmith/3-2-mysql-quote-numeric
[3.2] active_record: Quote numeric values compared to string columns.
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/test/cases/relation/where_test.rb')
-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 |