diff options
author | Rick Olson <technoweenie@gmail.com> | 2006-03-16 03:24:40 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2006-03-16 03:24:40 +0000 |
commit | a0c459bca7a22b6c62760ef213147475823dcea0 (patch) | |
tree | ebd0c101e6d2b616355a010c8499ba7549d5845f /activerecord | |
parent | 9b9a0908e5a834d981bd095099d9cefc3abdb226 (diff) | |
download | rails-a0c459bca7a22b6c62760ef213147475823dcea0.tar.gz rails-a0c459bca7a22b6c62760ef213147475823dcea0.tar.bz2 rails-a0c459bca7a22b6c62760ef213147475823dcea0.zip |
fix test_find_in_association_with_options test, tweak other tests affected by developer/project addition
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3890 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rwxr-xr-x | activerecord/test/associations_test.rb | 28 | ||||
-rwxr-xr-x | activerecord/test/deprecated_associations_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/finder_test.rb | 2 | ||||
-rw-r--r-- | activerecord/test/fixtures/developers_projects.yml | 4 |
4 files changed, 21 insertions, 17 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index df15d0d0b0..c4c497575b 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -1090,7 +1090,7 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase active_record = Project.find(1) assert !active_record.developers.empty? - assert_equal 2, active_record.developers.size + assert_equal 3, active_record.developers.size assert active_record.developers.include?(david) end @@ -1282,7 +1282,7 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase def test_uniq_before_the_fact projects(:active_record).developers << developers(:jamis) projects(:active_record).developers << developers(:david) - assert_equal 2, projects(:active_record, :reload).developers.size + assert_equal 3, projects(:active_record, :reload).developers.size end def test_deleting @@ -1290,13 +1290,13 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase active_record = Project.find(1) david.projects.reload assert_equal 2, david.projects.size - assert_equal 2, active_record.developers.size + assert_equal 3, active_record.developers.size david.projects.delete(active_record) assert_equal 1, david.projects.size assert_equal 1, david.projects(true).size - assert_equal 1, active_record.developers(true).size + assert_equal 2, active_record.developers(true).size end def test_deleting_array @@ -1311,16 +1311,16 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase david = Developer.find(1) active_record = Project.find(1) active_record.developers.reload - assert_equal 2, active_record.developers_by_sql.size + assert_equal 3, active_record.developers_by_sql.size active_record.developers_by_sql.delete(david) - assert_equal 1, active_record.developers_by_sql(true).size + assert_equal 2, active_record.developers_by_sql(true).size end def test_deleting_array_with_sql active_record = Project.find(1) active_record.developers.reload - assert_equal 2, active_record.developers_by_sql.size + assert_equal 3, active_record.developers_by_sql.size active_record.developers_by_sql.delete(Developer.find(:all)) assert_equal 0, active_record.developers_by_sql(true).size @@ -1364,14 +1364,14 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase end def test_associations_with_conditions - assert_equal 2, projects(:active_record).developers.size + assert_equal 3, projects(:active_record).developers.size assert_equal 1, projects(:active_record).developers_named_david.size assert_equal developers(:david), projects(:active_record).developers_named_david.find(developers(:david).id) assert_equal developers(:david), projects(:active_record).salaried_developers.find(developers(:david).id) projects(:active_record).developers_named_david.clear - assert_equal 1, projects(:active_record, :reload).developers.size + assert_equal 2, projects(:active_record, :reload).developers.size end def test_find_in_association @@ -1399,7 +1399,7 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase def test_find_with_merged_options assert_equal 1, projects(:active_record).limited_developers.size assert_equal 1, projects(:active_record).limited_developers.find(:all).size - assert_equal 2, projects(:active_record).limited_developers.find(:all, :limit => nil).size + assert_equal 3, projects(:active_record).limited_developers.find(:all, :limit => nil).size end def test_new_with_values_in_collection @@ -1414,12 +1414,12 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase assert project.developers.include?(david) end - def xtest_find_in_association_with_options + def test_find_in_association_with_options developers = projects(:active_record).developers.find(:all) - assert_equal 2, developers.size + assert_equal 3, developers.size - assert_equal developers(:david), projects(:active_record).developers.find(:first, :conditions => "salary < 10000") - assert_equal developers(:jamis), projects(:active_record).developers.find(:first, :order => "salary DESC") + assert_equal developers(:poor_jamis), projects(:active_record).developers.find(:first, :conditions => "salary < 10000") + assert_equal developers(:jamis), projects(:active_record).developers.find(:first, :order => "salary DESC") end def test_replace_with_less diff --git a/activerecord/test/deprecated_associations_test.rb b/activerecord/test/deprecated_associations_test.rb index 5772ab1335..d3abe145ed 100755 --- a/activerecord/test/deprecated_associations_test.rb +++ b/activerecord/test/deprecated_associations_test.rb @@ -181,7 +181,7 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase active_record = Project.find(1) assert active_record.has_developers? - assert_equal 2, active_record.developers_count + assert_equal 3, active_record.developers_count assert active_record.developers.include?(david) end @@ -192,7 +192,7 @@ class DeprecatedAssociationsTest < Test::Unit::TestCase david.remove_projects(active_record) assert_equal 1, david.projects_count - assert_equal 1, active_record.developers_count + assert_equal 2, active_record.developers_count end def test_has_and_belongs_to_many_zero diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb index bf7237b684..65e8dc9229 100644 --- a/activerecord/test/finder_test.rb +++ b/activerecord/test/finder_test.rb @@ -339,7 +339,7 @@ class FinderTest < Test::Unit::TestCase :joins => 'LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id', :conditions => 'project_id=1' ) - assert_equal 2, developers_on_project_one.length + assert_equal 3, developers_on_project_one.length developer_names = developers_on_project_one.map { |d| d.name } assert developer_names.include?('David') assert developer_names.include?('Jamis') diff --git a/activerecord/test/fixtures/developers_projects.yml b/activerecord/test/fixtures/developers_projects.yml index b1194a6f16..572958707f 100644 --- a/activerecord/test/fixtures/developers_projects.yml +++ b/activerecord/test/fixtures/developers_projects.yml @@ -11,3 +11,7 @@ david_active_record: jamis_active_record: developer_id: 2 project_id: 1 + +poor_jamis_active_record: + developer_id: 11 + project_id: 1
\ No newline at end of file |