Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix test_find_in_association_with_options test, tweak other tests aff…

…ected by developer/project addition

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3890 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit a0c459bca7a22b6c62760ef213147475823dcea0 1 parent 9b9a090
@technoweenie technoweenie authored
View
28 activerecord/test/associations_test.rb
@@ -1090,7 +1090,7 @@ def test_has_and_belongs_to_many
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 @@ def test_uniq_after_the_fact
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 @@ def test_deleting
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 @@ def test_deleting_with_sql
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 @@ def test_rich_association
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 @@ def test_find_in_association_with_custom_finder_sql_and_string_id
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 @@ def test_new_with_values_in_collection
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
View
4 activerecord/test/deprecated_associations_test.rb
@@ -181,7 +181,7 @@ def test_has_and_belongs_to_many
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 @@ def test_has_and_belongs_to_many_removing
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
View
2  activerecord/test/finder_test.rb
@@ -339,7 +339,7 @@ def test_find_all_with_join
: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')
View
4 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
Please sign in to comment.
Something went wrong with that request. Please try again.