diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-02-08 05:22:38 -0800 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-02-08 05:22:38 -0800 |
commit | 85e1c4a058b32e3d1358ca5e24b469bdd658fc9c (patch) | |
tree | 91d115ad295551d0f6e75c08047ccdbe01e6f59b /activerecord/test | |
parent | bcf0e08a8df372ef1be376587e5bc206c740e5ef (diff) | |
parent | 16f6f2592e4e6c22f06d75eb8a6ec0cb68c9404b (diff) | |
download | rails-85e1c4a058b32e3d1358ca5e24b469bdd658fc9c.tar.gz rails-85e1c4a058b32e3d1358ca5e24b469bdd658fc9c.tar.bz2 rails-85e1c4a058b32e3d1358ca5e24b469bdd658fc9c.zip |
Merge pull request #9216 from robertomiranda/where-with-empty-array
Activer Record: Change behaviour with empty array in where clause
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 9 | ||||
-rw-r--r-- | activerecord/test/cases/relation/where_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 5 |
3 files changed, 6 insertions, 12 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index a9fa107749..683e4fbd97 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -808,15 +808,6 @@ class FinderTest < ActiveRecord::TestCase assert_equal [2, 1].sort, client_of.compact.sort end - def test_find_with_nil_inside_set_passed_for_attribute - client_of = Company.all.merge!( - :where => { :client_of => [nil] }, - :order => 'client_of DESC' - ).map { |x| x.client_of } - - assert_equal [], client_of.compact - end - def test_with_limiting_with_custom_select posts = Post.references(:authors).merge( :includes => :author, :select => ' posts.*, authors.id as "author_id"', diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb index 8c8f4267a9..ccbfcc0549 100644 --- a/activerecord/test/cases/relation/where_test.rb +++ b/activerecord/test/cases/relation/where_test.rb @@ -98,7 +98,9 @@ module ActiveRecord end def test_where_with_table_name_and_empty_array - assert_equal 0, Post.where(:id => []).count + assert_raises(ArgumentError) do + Post.where(:id => []) + end end def test_where_with_empty_hash_and_no_foreign_key diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 379c0c0758..981aa14e98 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -515,8 +515,9 @@ class RelationTest < ActiveRecord::TestCase end def test_find_in_empty_array - authors = Author.all.where(:id => []) - assert authors.to_a.blank? + assert_raises(ArgumentError) do + Author.all.where(:id => []) + end end def test_where_with_ar_object |