Add missing :author_addresses in `OrderTest`

This commit addresses this CI failure https://buildkite.com/rails/rails-nightly/builds/247#018e0bea-7a88-45eb-94fa-be4155aeeeca/1164-1173

- Error without this commit
```ruby
$ bin/test test/cases/relation/order_test.rb test/cases/fixtures_test.rb -n "/^(?:OrderTest#(?:test_order_desc)|FixturesWithForeignKeyViolationsTest#(?:test_does_not_raise_if_no_fk_violations))$/" --seed 31115
Using sqlite3
Run options: -n "/^(?:OrderTest#(?:test_order_desc)|FixturesWithForeignKeyViolationsTest#(?:test_does_not_raise_if_no_fk_violations))$/" --seed 31115

.E

Error:
FixturesWithForeignKeyViolationsTest#test_does_not_raise_if_no_fk_violations:
RuntimeError: Foreign key violations found in your fixture data. Ensure you aren't referring to labels that don't exist on associations. Error from database:

Foreign key violations found: authors, authors, authors
    lib/active_record/fixtures.rb:704:in `rescue in check_all_foreign_keys_valid!'
    lib/active_record/fixtures.rb:701:in `check_all_foreign_keys_valid!'
    lib/active_record/fixtures.rb:688:in `block (2 levels) in insert'
    lib/active_record/connection_adapters/abstract/connection_pool.rb:384:in `with_connection'
    lib/active_record/fixtures.rb:685:in `block in insert'
    lib/active_record/fixtures.rb:676:in `each'
    lib/active_record/fixtures.rb:676:in `insert'
    lib/active_record/fixtures.rb:662:in `read_and_insert'
    lib/active_record/fixtures.rb:607:in `create_fixtures'
    test/cases/fixtures_test.rb:893:in `block (2 levels) in test_does_not_raise_if_no_fk_violations'
    /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/testing/assertions.rb:49:in `assert_nothing_raised'
    test/cases/fixtures_test.rb:892:in `block in test_does_not_raise_if_no_fk_violations'
    test/cases/fixtures_test.rb:906:in `with_verify_foreign_keys_for_fixtures'
    test/cases/fixtures_test.rb:891:in `test_does_not_raise_if_no_fk_violations'

bin/test test/cases/fixtures_test.rb:884

Finished in 0.084771s, 23.5930 runs/s, 94.3720 assertions/s.
2 runs, 8 assertions, 0 failures, 1 errors, 0 skips
$
```

Refer to #43873 that has the same reason why it gets error.
This commit is contained in:
Yasuo Honda 2024-03-05 14:22:31 +09:00
parent db30dd6fe7
commit 3a7d96c485
1 changed files with 1 additions and 1 deletions

View File

@ -5,7 +5,7 @@ require "models/author"
require "models/book"
class OrderTest < ActiveRecord::TestCase
fixtures :authors
fixtures :authors, :author_addresses
def test_order_asc
Book.destroy_all