diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-08-18 17:22:06 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-08-18 17:22:06 +0900 |
commit | 53524818bf8cdc752f721f1a5ac944a1543466f4 (patch) | |
tree | b8de627b571fce706541edb4c4f97860c0968076 /activerecord/test | |
parent | 18abe37aa8bbc5012124f90aaf93336a57b52642 (diff) | |
download | rails-53524818bf8cdc752f721f1a5ac944a1543466f4.tar.gz rails-53524818bf8cdc752f721f1a5ac944a1543466f4.tar.bz2 rails-53524818bf8cdc752f721f1a5ac944a1543466f4.zip |
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
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 10 |
1 files changed, 9 insertions, 1 deletions
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) |