Fix some test failures due to MySQL assumptions. Closes #3149.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3254 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2005-12-08 23:23:34 +00:00
parent 57838bd4c6
commit dc106b932c
2 changed files with 15 additions and 6 deletions

@ -222,17 +222,23 @@ def test_preconfigured_includes_with_has_one
def test_preconfigured_includes_with_has_many
posts = authors(:david).posts_with_comments
assert_equal 2, posts.first.comments.size
one = posts.detect { |p| p.id == 1 }
assert_equal 5, posts.size
assert_equal 2, one.comments.size
end
def test_preconfigured_includes_with_habtm
posts = authors(:david).posts_with_categories
assert_equal 2, posts.first.categories.size
one = posts.detect { |p| p.id == 1 }
assert_equal 5, posts.size
assert_equal 2, one.categories.size
end
def test_preconfigured_includes_with_has_many_and_habtm
posts = authors(:david).posts_with_comments_and_categories
assert_equal 2, posts.first.comments.size
assert_equal 2, posts.first.categories.size
one = posts.detect { |p| p.id == 1 }
assert_equal 5, posts.size
assert_equal 2, one.comments.size
assert_equal 2, one.categories.size
end
end

@ -1404,7 +1404,10 @@ def test_update_attributes_after_push_without_duplicate_join_table_rows
assert developer.save
developer.projects << project
developer.update_attribute("name", "Bruza")
assert_equal 1, developer.connection.select_one("SELECT count(*) FROM developers_projects WHERE
project_id = #{project.id} AND developer_id = #{developer.id}")["count(*)"].to_i
assert_equal 1, Developer.connection.select_value(<<-end_sql).to_i
SELECT count(*) FROM developers_projects
WHERE project_id = #{project.id}
AND developer_id = #{developer.id}
end_sql
end
end