Skip to content

Commit 69e6bae

Browse files
Load ambient fixtures for ActiveRecordMessagePackTest
`ActiveRecordMessagePackTest` does not use any fixtures, but fixtures that were previously loaded without preserving referential integrity can affect query results. For example, if previous tests load `:comments` fixtures but not `:posts` fixtures, there will be `Comment` records in the database with `post_id = 1` but no corresponding `Post` record. Then, when a `Post` is created in `ActiveRecordMessagePackTest`, its `comments` association will accidentally include those prior `Comment` records. This commit loads ambient fixtures for the relevant models in `ActiveRecordMessagePackTest` to prevent such accidental results. Fixes rails#49143.
1 parent e4d47ea commit 69e6bae

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

activerecord/test/cases/message_pack_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
require "active_record/message_pack"
1010

1111
class ActiveRecordMessagePackTest < ActiveRecord::TestCase
12+
fixtures :posts, :comments, :authors
13+
1214
test "enshrines type IDs" do
1315
expected = {
1416
119 => ActiveModel::Type::Binary::Data,

0 commit comments

Comments
 (0)