mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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
This commit is contained in:
parent
18abe37aa8
commit
53524818bf
1 changed files with 9 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue