diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-24 13:02:50 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-24 13:02:50 +0000 |
commit | 93ec1303779a238754c87572e6e96d32133cee86 (patch) | |
tree | bb0ad7b112b0dc52c7ab44936a1dbbb1ffabea96 /activerecord/test/finder_test.rb | |
parent | 0725498d6f37c93a697468d3f5d4743861b84542 (diff) | |
download | rails-93ec1303779a238754c87572e6e96d32133cee86.tar.gz rails-93ec1303779a238754c87572e6e96d32133cee86.tar.bz2 rails-93ec1303779a238754c87572e6e96d32133cee86.zip |
Fixed that the dynamic finders didnt treat nil as a "IS NULL" but rather "= NULL" case #515 [Demetrius]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@488 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/finder_test.rb')
-rwxr-xr-x | activerecord/test/finder_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb index d79bc0f365..5944717132 100755 --- a/activerecord/test/finder_test.rb +++ b/activerecord/test/finder_test.rb @@ -193,6 +193,29 @@ class FinderTest < Test::Unit::TestCase assert_equal [], Topic.find_all_by_title("The First Topic!!") end + + def test_find_by_nil_attribute + topic = Topic.find_by_last_read nil + assert_not_nil topic + assert_nil topic.last_read + end + + def test_find_all_by_nil_attribute + topics = Topic.find_all_by_last_read nil + assert_equal 1, topics.size + assert_nil topics[0].last_read + end + + def test_find_by_nil_and_not_nil_attributes + topic = Topic.find_by_last_read_and_author_name nil, "Mary" + assert_equal "Mary", topic.author_name + end + + def test_find_all_by_nil_and_not_nil_attributes + topics = Topic.find_all_by_last_read_and_author_name nil, "Mary" + assert_equal 1, topics.size + assert_equal "Mary", topics[0].author_name + end protected def bind(statement, *vars) |