From 53524818bf8cdc752f721f1a5ac944a1543466f4 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 18 Aug 2017 17:22:06 +0900 Subject: Add deterministic sorting order for `test_taking_with_a_number` Otherwise random CI failure will be caused. https://travis-ci.org/rails/rails/jobs/265848046#L777 --- .../test/cases/associations/has_many_associations_test.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'activerecord/test/cases/associations') diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 383c7314e1..6bd11a5d81 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -576,8 +576,16 @@ class HasManyAssociationsTest < ActiveRecord::TestCase end def test_taking_with_a_number + klass = Class.new(Author) do + has_many :posts, -> { order(:id) } + + def self.name + "Author" + end + end + # taking from unloaded Relation - bob = Author.find(authors(:bob).id) + bob = klass.find(authors(:bob).id) new_post = bob.posts.build assert_not bob.posts.loaded? assert_equal [posts(:misc_by_bob)], bob.posts.take(1) -- cgit v1.2.3