0
@@ -7,42 +7,54 @@ class FindersTest < Test::Unit::TestCase
0
@connection = ActiveRecord::Base.connection
0
- def test_activerecord_model_can_be_used_with_reserved_words
0
- group1 = Group.create!(:order => "x")
0
- group2 = Group.create!(:order => "y")
0
- assert_nothing_raised { x = Group.new }
0
- assert_nothing_raised { x.save }
0
- assert_nothing_raised { x.save }
0
- assert_nothing_raised { y = Group.find_by_order('y') }
0
- assert_nothing_raised { y = Group.find(group2.id) }
0
- x = Group.find(group1.id)
0
- def test_find_on_hash_conditions_with_explicit_table_name
0
- group1 = Group.create!(:order => "x")
0
- assert Group.find(group1.id, :conditions => { "group.order" => "x" })
0
- assert_raises(ActiveRecord::RecordNotFound) {
0
- Group.find(group1.id, :conditions => { 'group.order' => "y" })
0
+ # def test_activerecord_model_can_be_used_with_reserved_words
0
+ # group1 = Group.create!(:order => "x")
0
+ # group2 = Group.create!(:order => "y")
0
+ # assert_nothing_raised { x = Group.new }
0
+ # assert_nothing_raised { x.save }
0
+ # assert_nothing_raised { x.save }
0
+ # assert_nothing_raised { y = Group.find_by_order('y') }
0
+ # assert_nothing_raised { y = Group.find(group2.id) }
0
+ # x = Group.find(group1.id)
0
+ # def test_find_on_hash_conditions_with_explicit_table_name
0
+ # group1 = Group.create!(:order => "x")
0
+ # assert Group.find(group1.id, :conditions => { "group.order" => "x" })
0
+ # assert_raises(ActiveRecord::RecordNotFound) {
0
+ # Group.find(group1.id, :conditions => { 'group.order' => "y" })
0
+ # def test_exists_with_aggregate_having_three_mappings
0
+ # topic = Topic.create! :title => "SomeBook", :author_name => "Joe Smith"
0
+ # assert Topic.exists?(:description => topic.description)
0
+ # topic = Topic.new :title => "MayDay", :author_name => "Joe Smith the 2nd"
0
+ # assert !Topic.exists?(:description => topic.description)
0
+ # def test_find_with_aggregate
0
+ # topic = Topic.create! :title => "SomeBook", :author_name => "Joe Smith"
0
+ # assert_equal topic, Topic.find(:first, :conditions => { :description => topic.description })
0
+ # topic = Topic.new :title => "MayDay", :author_name => "Joe Smith the 2nd"
0
+ # assert !Topic.find(:first, :conditions => { :description => topic.description })
0
- def test_exists_with_aggregate_having_three_mappings
0
- topic = Topic.create! :title => "SomeBook", :author_name => "Joe Smith"
0
- assert Topic.exists?(:description => topic.description)
0
- topic = Topic.new :title => "MayDay", :author_name => "Joe Smith the 2nd"
0
- assert !Topic.exists?(:description => topic.description)
0
+ def test_find_with_blank_conditions
0
+ topic = Topic.create! :author_name => "Zach Dennis", :title => "Books by Brooks"
0
+ topic.books << Book.create!(:title => "Sword of Shannara", :author_name => "Terry Brooks", :publisher => "DelRey")
0
+ topic.books << Book.create!(:title => "Gemstones of Shannara", :author_name => "Terry Brooks", :publisher => "DelRey")
0
+ [[], {}, nil, ""].each do |blank|
0
+ assert_equal 2, Topic.find(:first).books.find(:all, :conditions => blank).size
0
- def test_find_with_aggregate
0
- topic = Topic.create! :title => "SomeBook", :author_name => "Joe Smith"
0
- assert_equal topic, Topic.find(:first, :conditions => { :description => topic.description })
0
- topic = Topic.new :title => "MayDay", :author_name => "Joe Smith the 2nd"
0
- assert !Topic.find(:first, :conditions => { :description => topic.description })