aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/inner_join_association_test.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-01-14 13:36:33 +0530
committerPratik Naik <pratiknaik@gmail.com>2010-01-16 00:02:46 +0530
commitbed9179aa1496f6d28891cf515af0d7e515ebbab (patch)
treeb0c551489b45f93f66c0d726c55fe000b59803ea /activerecord/test/cases/associations/inner_join_association_test.rb
parent1c30ec23fef2479cd037945e57a74e5c89c9ece1 (diff)
downloadrails-bed9179aa1496f6d28891cf515af0d7e515ebbab.tar.gz
rails-bed9179aa1496f6d28891cf515af0d7e515ebbab.tar.bz2
rails-bed9179aa1496f6d28891cf515af0d7e515ebbab.zip
Make scopes use relations under the hood
Diffstat (limited to 'activerecord/test/cases/associations/inner_join_association_test.rb')
-rw-r--r--activerecord/test/cases/associations/inner_join_association_test.rb28
1 files changed, 0 insertions, 28 deletions
diff --git a/activerecord/test/cases/associations/inner_join_association_test.rb b/activerecord/test/cases/associations/inner_join_association_test.rb
index 18a1cd3cd0..43abcae75e 100644
--- a/activerecord/test/cases/associations/inner_join_association_test.rb
+++ b/activerecord/test/cases/associations/inner_join_association_test.rb
@@ -8,39 +8,11 @@ require 'models/categorization'
class InnerJoinAssociationTest < ActiveRecord::TestCase
fixtures :authors, :posts, :comments, :categories, :categories_posts, :categorizations
- def test_construct_finder_sql_creates_inner_joins
- sql = Author.joins(:posts).to_sql
- assert_match /INNER JOIN .?posts.? ON .?posts.?.author_id = authors.id/, sql
- end
-
- def test_construct_finder_sql_cascades_inner_joins
- sql = Author.joins(:posts => :comments).to_sql
- assert_match /INNER JOIN .?posts.? ON .?posts.?.author_id = authors.id/, sql
- assert_match /INNER JOIN .?comments.? ON .?comments.?.post_id = posts.id/, sql
- end
-
- def test_construct_finder_sql_inner_joins_through_associations
- sql = Author.joins(:categorized_posts).to_sql
- assert_match /INNER JOIN .?categorizations.?.*INNER JOIN .?posts.?/, sql
- end
-
- def test_construct_finder_sql_applies_association_conditions
- sql = Author.joins(:categories_like_general).where("TERMINATING_MARKER").to_sql
- assert_match /INNER JOIN .?categories.? ON.*AND.*.?General.?(.|\n)*TERMINATING_MARKER/, sql
- end
-
def test_construct_finder_sql_applies_aliases_tables_on_association_conditions
result = Author.joins(:thinking_posts, :welcome_posts).to_a
assert_equal authors(:david), result.first
end
- def test_construct_finder_sql_unpacks_nested_joins
- sql = Author.joins(:posts => [[:comments]]).to_sql
- assert_no_match /inner join.*inner join.*inner join/i, sql, "only two join clauses should be present"
- assert_match /INNER JOIN .?posts.? ON .?posts.?.author_id = authors.id/, sql
- assert_match /INNER JOIN .?comments.? ON .?comments.?.post_id = .?posts.?.id/, sql
- end
-
def test_construct_finder_sql_ignores_empty_joins_hash
sql = Author.joins({}).to_sql
assert_no_match /JOIN/i, sql