From 79823e0b2fa3b6d34aca1945d25e2f2574635823 Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Sat, 10 Nov 2007 21:33:13 +0000 Subject: Ensure that column names are quoted. Closes #10134 [wesley.moxam] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8126 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../test/associations/inner_join_association_test.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'activerecord/test/associations') diff --git a/activerecord/test/associations/inner_join_association_test.rb b/activerecord/test/associations/inner_join_association_test.rb index 983f269e87..8d583f2138 100644 --- a/activerecord/test/associations/inner_join_association_test.rb +++ b/activerecord/test/associations/inner_join_association_test.rb @@ -10,30 +10,30 @@ class InnerJoinAssociationTest < Test::Unit::TestCase def test_construct_finder_sql_creates_inner_joins sql = Author.send(:construct_finder_sql, :joins => :posts) - assert_match /INNER JOIN posts ON posts.author_id = authors.id/, sql + assert_match /INNER JOIN `?posts`? ON `?posts`?.author_id = authors.id/, sql end def test_construct_finder_sql_cascades_inner_joins sql = Author.send(:construct_finder_sql, :joins => {:posts => :comments}) - assert_match /INNER JOIN posts ON posts.author_id = authors.id/, sql - assert_match /INNER JOIN comments ON comments.post_id = posts.id/, 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.send(:construct_finder_sql, :joins => :categorized_posts) - assert_match /INNER JOIN categorizations.*INNER JOIN posts/, sql + assert_match /INNER JOIN `?categorizations`?.*INNER JOIN `?posts`?/, sql end def test_construct_finder_sql_applies_association_conditions sql = Author.send(:construct_finder_sql, :joins => :categories_like_general, :conditions => "TERMINATING_MARKER") - assert_match /INNER JOIN categories ON.*AND.*'General'.*TERMINATING_MARKER/, sql + assert_match /INNER JOIN `?categories`? ON.*AND.*`?General`?.*TERMINATING_MARKER/, sql end def test_construct_finder_sql_unpacks_nested_joins sql = Author.send(:construct_finder_sql, :joins => {:posts => [[:comments]]}) 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 + 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 -- cgit v1.2.3