aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-10-30 10:53:37 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-10-30 10:53:37 -0600
commit3cd49570c55334b25e37401176a17b0824512db2 (patch)
tree61c3165528f10f72537b28fdbcc160348b398d0c /activerecord/test/cases
parent6c61ae816ad7326e510a8f019cadc6db4cc9dae0 (diff)
downloadrails-3cd49570c55334b25e37401176a17b0824512db2.tar.gz
rails-3cd49570c55334b25e37401176a17b0824512db2.tar.bz2
rails-3cd49570c55334b25e37401176a17b0824512db2.zip
Fix test failures caused by #12071
This assumes only one query was ever executed, but it appears to sometimes be loading schema information. We can just look at the array of queries, rather than the "first" one that was run
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/left_outer_join_association_test.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/activerecord/test/cases/associations/left_outer_join_association_test.rb b/activerecord/test/cases/associations/left_outer_join_association_test.rb
index a362b43cc3..4be9264f81 100644
--- a/activerecord/test/cases/associations/left_outer_join_association_test.rb
+++ b/activerecord/test/cases/associations/left_outer_join_association_test.rb
@@ -16,11 +16,11 @@ class LeftOuterJoinAssociationTest < ActiveRecord::TestCase
def test_construct_finder_sql_does_not_table_name_collide_on_duplicate_associations
assert_nothing_raised do
- sql = capture_sql do
+ queries = capture_sql do
Person.left_outer_joins(:agents => {:agents => :agents})
.left_outer_joins(:agents => {:agents => {:primary_contact => :agents}}).to_a
- end.first
- assert_match(/agents_people_4/i, sql)
+ end
+ assert queries.any? { |sql| /agents_people_4/i =~ sql }
end
end
@@ -30,13 +30,13 @@ class LeftOuterJoinAssociationTest < ActiveRecord::TestCase
end
def test_construct_finder_sql_ignores_empty_left_outer_joins_hash
- sql = capture_sql { Author.left_outer_joins({}) }.first
- assert_no_match(/LEFT OUTER JOIN/i, sql)
+ queries = capture_sql { Author.left_outer_joins({}) }
+ assert queries.none? { |sql| /LEFT OUTER JOIN/i =~ sql }
end
def test_construct_finder_sql_ignores_empty_left_outer_joins_array
- sql = capture_sql { Author.left_outer_joins([]) }.first
- assert_no_match(/LEFT OUTER JOIN/i, sql)
+ queries = capture_sql { Author.left_outer_joins([]) }
+ assert queries.none? { |sql| /LEFT OUTER JOIN/i =~ sql }
end
def test_left_outer_joins_forbids_to_use_string_as_argument
@@ -44,9 +44,9 @@ class LeftOuterJoinAssociationTest < ActiveRecord::TestCase
end
def test_join_conditions_added_to_join_clause
- sql = capture_sql { Author.left_outer_joins(:essays).to_a }.first
- assert_match(/writer_type.*?=.*?(Author|\?|\$1)/i, sql)
- assert_no_match(/WHERE/i, sql)
+ queries = capture_sql { Author.left_outer_joins(:essays).to_a }
+ assert queries.any? { |sql| /writer_type.*?=.*?(Author|\?|\$1)/i =~ sql }
+ assert queries.none? { |sql| /WHERE/i =~ sql }
end
def test_find_with_sti_join