aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-05-26 00:35:49 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-05-26 00:35:49 +0000
commit2be3a33f32b43287b692be2cc2550f159b00165e (patch)
tree4b5b55de4af68f8bc2b7d23b73687ba33d83bc77 /activerecord/test
parent9dac6b759f57d93247ba6e8b8d8c7b9d5638dc22 (diff)
downloadrails-2be3a33f32b43287b692be2cc2550f159b00165e.tar.gz
rails-2be3a33f32b43287b692be2cc2550f159b00165e.tar.bz2
rails-2be3a33f32b43287b692be2cc2550f159b00165e.zip
find gracefully copes with blank :conditions. Closes #7599.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6852 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/finder_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb
index 1c4b9d4777..de7d1b4318 100644
--- a/activerecord/test/finder_test.rb
+++ b/activerecord/test/finder_test.rb
@@ -1,4 +1,5 @@
require 'abstract_unit'
+require 'fixtures/comment'
require 'fixtures/company'
require 'fixtures/topic'
require 'fixtures/reply'
@@ -128,6 +129,18 @@ class FinderTest < Test::Unit::TestCase
assert topic.attribute_present?("author_name")
assert topic.respond_to?("author_name")
end
+
+ def test_find_on_blank_conditions
+ [nil, " ", [], {}].each do |blank|
+ assert_nothing_raised { Topic.find(:first, :conditions => blank) }
+ end
+ end
+
+ def test_find_on_blank_bind_conditions
+ [ [""], ["",{}] ].each do |blank|
+ assert_nothing_raised { Topic.find(:first, :conditions => blank) }
+ end
+ end
def test_find_on_array_conditions
assert Topic.find(1, :conditions => ["approved = ?", false])