diff options
author | Patrick Rebsch <pjrebsch@gmail.com> | 2019-03-01 20:31:59 -0500 |
---|---|---|
committer | Patrick Rebsch <pjrebsch@gmail.com> | 2019-03-07 19:22:29 -0500 |
commit | 3e6d3e430e53c550e3c282af6f23b803e1652b15 (patch) | |
tree | 59f7b6db3bec125e632a7cb908945312473cf69d /activerecord/test | |
parent | a62683f3e4326b222b6ad95b8b2dfcc31026d227 (diff) | |
download | rails-3e6d3e430e53c550e3c282af6f23b803e1652b15.tar.gz rails-3e6d3e430e53c550e3c282af6f23b803e1652b15.tar.bz2 rails-3e6d3e430e53c550e3c282af6f23b803e1652b15.zip |
Quote empty ranges like other empty enumerables
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/sanitize_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/sanitize_test.rb b/activerecord/test/cases/sanitize_test.rb index 18b27bd6d1..6c884b4f45 100644 --- a/activerecord/test/cases/sanitize_test.rb +++ b/activerecord/test/cases/sanitize_test.rb @@ -148,6 +148,19 @@ class SanitizeTest < ActiveRecord::TestCase assert_equal "foo in (#{quoted_nil})", bind("foo in (?)", []) end + def test_bind_range + quoted_abc = %(#{ActiveRecord::Base.connection.quote('a')},#{ActiveRecord::Base.connection.quote('b')},#{ActiveRecord::Base.connection.quote('c')}) + assert_equal "0", bind("?", 0..0) + assert_equal "1,2,3", bind("?", 1..3) + assert_equal quoted_abc, bind("?", "a"..."d") + end + + def test_bind_empty_range + quoted_nil = ActiveRecord::Base.connection.quote(nil) + assert_equal quoted_nil, bind("?", 0...0) + assert_equal quoted_nil, bind("?", "a"..."a") + end + def test_bind_empty_string quoted_empty = ActiveRecord::Base.connection.quote("") assert_equal quoted_empty, bind("?", "") |