diff options
author | Will Bryant <will.bryant@gmail.com> | 2009-02-04 13:01:03 +1300 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-02-06 13:43:02 +1300 |
commit | 9991868d85b25da672bf119bfcbff22a4bb6e8f1 (patch) | |
tree | 7f956a6f83d9b0aca69e84b712a3c83fb677c6b7 /activerecord/test/cases | |
parent | ba146a84d0ed8a886fdc6b6794ce99a9d37c0190 (diff) | |
download | rails-9991868d85b25da672bf119bfcbff22a4bb6e8f1.tar.gz rails-9991868d85b25da672bf119bfcbff22a4bb6e8f1.tar.bz2 rails-9991868d85b25da672bf119bfcbff22a4bb6e8f1.zip |
support end-exclusive ... Ranges in SQL hash condition sanitization properly
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1865 state:committed]
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index aac5e6a96b..ee8f4901f9 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -307,6 +307,12 @@ class FinderTest < ActiveRecord::TestCase assert_raises(ActiveRecord::RecordNotFound) { Topic.find(1, :conditions => { :id => 2..3 }) } end + def test_find_on_hash_conditions_with_end_exclusive_range + assert_equal [1,2,3], Topic.find(:all, :conditions => { :id => 1..3 }).map(&:id).sort + assert_equal [1,2], Topic.find(:all, :conditions => { :id => 1...3 }).map(&:id).sort + assert_raises(ActiveRecord::RecordNotFound) { Topic.find(3, :conditions => { :id => 2...3 }) } + end + def test_find_on_hash_conditions_with_multiple_ranges assert_equal [1,2,3], Comment.find(:all, :conditions => { :id => 1..3, :post_id => 1..2 }).map(&:id).sort assert_equal [1], Comment.find(:all, :conditions => { :id => 1..1, :post_id => 1..10 }).map(&:id).sort |