aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/relation/merging_test.rb12
-rw-r--r--activerecord/test/cases/relation/mutation_test.rb6
2 files changed, 13 insertions, 5 deletions
diff --git a/activerecord/test/cases/relation/merging_test.rb b/activerecord/test/cases/relation/merging_test.rb
index 9f9244f9b2..23500bf5d8 100644
--- a/activerecord/test/cases/relation/merging_test.rb
+++ b/activerecord/test/cases/relation/merging_test.rb
@@ -146,5 +146,17 @@ class MergingDifferentRelationsTest < ActiveRecord::TestCase
merge(Author.order(:name)).pluck("authors.name")
assert_equal ["Bob", "Bob", "David"], posts_by_author_name
+
+ posts_by_author_name = Post.limit(3).joins(:author).
+ merge(Author.order("name")).pluck("authors.name")
+
+ assert_equal ["Bob", "Bob", "David"], posts_by_author_name
+ end
+
+ test "merging order relations (using a hash argument)" do
+ posts_by_author_name = Post.limit(4).joins(:author).
+ merge(Author.order(name: :desc)).pluck("authors.name")
+
+ assert_equal ["Mary", "Mary", "Mary", "David"], posts_by_author_name
end
end
diff --git a/activerecord/test/cases/relation/mutation_test.rb b/activerecord/test/cases/relation/mutation_test.rb
index 020fb24afa..a70f979442 100644
--- a/activerecord/test/cases/relation/mutation_test.rb
+++ b/activerecord/test/cases/relation/mutation_test.rb
@@ -7,10 +7,6 @@ module ActiveRecord
extend ActiveRecord::Delegation::DelegateCache
inherited self
- def arel_table
- Post.arel_table
- end
-
def connection
Post.connection
end
@@ -21,7 +17,7 @@ module ActiveRecord
end
def relation
- @relation ||= Relation.new FakeKlass.new('posts'), :b
+ @relation ||= Relation.new FakeKlass.new('posts'), Post.arel_table
end
(Relation::MULTI_VALUE_METHODS - [:references, :extending, :order]).each do |method|