aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/scoping
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2017-05-29 20:37:35 +0200
committerKasper Timm Hansen <kaspth@gmail.com>2017-05-29 20:37:35 +0200
commite1758b5e8c8d49fdf931b0b3f8009810880113a6 (patch)
tree97181998af56fff415827af679253b1472aa0006 /activerecord/test/cases/scoping
parent61413b592dbbd6d7adbcb16fb95f760b0656cd9b (diff)
parente7a33a5ed74cc0987544396f0742110fa5a5e228 (diff)
downloadrails-e1758b5e8c8d49fdf931b0b3f8009810880113a6.tar.gz
rails-e1758b5e8c8d49fdf931b0b3f8009810880113a6.tar.bz2
rails-e1758b5e8c8d49fdf931b0b3f8009810880113a6.zip
Merge branch 'master' into unlock-minitest
Diffstat (limited to 'activerecord/test/cases/scoping')
-rw-r--r--activerecord/test/cases/scoping/relation_scoping_test.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/activerecord/test/cases/scoping/relation_scoping_test.rb b/activerecord/test/cases/scoping/relation_scoping_test.rb
index a1ae57fdbb..8535be8402 100644
--- a/activerecord/test/cases/scoping/relation_scoping_test.rb
+++ b/activerecord/test/cases/scoping/relation_scoping_test.rb
@@ -10,7 +10,7 @@ require "models/person"
require "models/reference"
class RelationScopingTest < ActiveRecord::TestCase
- fixtures :authors, :developers, :projects, :comments, :posts, :developers_projects
+ fixtures :authors, :author_addresses, :developers, :projects, :comments, :posts, :developers_projects
setup do
developers(:david)
@@ -229,16 +229,23 @@ class RelationScopingTest < ActiveRecord::TestCase
end
end
- def test_circular_joins_with_current_scope_does_not_crash
+ def test_circular_joins_with_scoping_does_not_crash
posts = Post.joins(comments: :post).scoping do
- Post.current_scope.first(10)
+ Post.first(10)
end
assert_equal posts, Post.joins(comments: :post).first(10)
end
+
+ def test_circular_left_joins_with_scoping_does_not_crash
+ posts = Post.left_joins(comments: :post).scoping do
+ Post.first(10)
+ end
+ assert_equal posts, Post.left_joins(comments: :post).first(10)
+ end
end
class NestedRelationScopingTest < ActiveRecord::TestCase
- fixtures :authors, :developers, :projects, :comments, :posts
+ fixtures :authors, :author_addresses, :developers, :projects, :comments, :posts
def test_merge_options
Developer.where("salary = 80000").scoping do