| | 1523 | def setup_habtm_association_with_duplicate_links |
|---|
| | 1524 | @duplicate_category = categories(:duplicates) |
|---|
| | 1525 | @duplicate_category.posts << posts(:welcome) << posts(:welcome) << posts(:welcome) |
|---|
| | 1526 | @duplicate_category.posts << posts(:thinking) << posts(:thinking) << posts(:thinking) |
|---|
| | 1527 | end |
|---|
| | 1528 | |
|---|
| | 1529 | def test_habtm_with_unique_eager_loading |
|---|
| | 1530 | setup_habtm_association_with_duplicate_links |
|---|
| | 1531 | assert_equal 2, @duplicate_category.posts.size |
|---|
| | 1532 | end |
|---|
| | 1533 | |
|---|
| | 1534 | def test_habtm_scoped_find_with_unique_eager_loading |
|---|
| | 1535 | setup_habtm_association_with_duplicate_links |
|---|
| | 1536 | assert_equal 2, @duplicate_category.posts.find(:all).size |
|---|
| | 1537 | end |
|---|
| | 1538 | |
|---|
| | 1539 | def test_habtm_scoped_find_with_unique_eager_loading_and_limit |
|---|
| | 1540 | setup_habtm_association_with_duplicate_links |
|---|
| | 1541 | assert_equal 2, @duplicate_category.posts.find(:all, :limit => 2).size |
|---|
| | 1542 | end |
|---|
| | 1543 | |
|---|
| | 1544 | def test_habtm_scoped_find_with_unique_eager_loading_and_include |
|---|
| | 1545 | setup_habtm_association_with_duplicate_links |
|---|
| | 1546 | assert_equal 2, @duplicate_category.posts.find(:all, :include => :author_with_posts).size |
|---|
| | 1547 | end |
|---|
| | 1548 | |
|---|
| | 1549 | def test_habtm_scoped_find_with_unique_eager_loading_and_limit_and_include_limitable_reflection |
|---|
| | 1550 | setup_habtm_association_with_duplicate_links |
|---|
| | 1551 | assert_equal 2, @duplicate_category.posts.find(:all, :limit => 2, :include => :author_with_posts).size |
|---|
| | 1552 | end |
|---|
| | 1553 | |
|---|
| | 1554 | def test_habtm_scoped_find_with_unique_eager_loading_and_limit_and_include_non_limitable_reflection |
|---|
| | 1555 | setup_habtm_association_with_duplicate_links |
|---|
| | 1556 | assert_equal 2, @duplicate_category.posts.find(:all, :limit => 2, :include => :readers).size |
|---|
| | 1557 | end |
|---|
| | 1558 | |
|---|