From 2be3a33f32b43287b692be2cc2550f159b00165e Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 26 May 2007 00:35:49 +0000 Subject: find gracefully copes with blank :conditions. Closes #7599. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6852 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/finder_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'activerecord/test') 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]) -- cgit v1.2.3