Commit 6583bca
Stub use_foreign_keys? instead of swapping the connection pool in specs
The previous spec re-established ActiveRecord::Base with
foreign_keys: false in before(:each) and restored CONNECTION_PARAMS in
after(:each). That swaps the global pool, so the outer describe's
before(:all)-captured @conn ends up pointing at a connection from the
discarded pool. A later spec (schema_dumper_spec.rb:571 "should specify
non-default tablespace in add index") then stubs default_tablespace on
that stale @conn, while SchemaDumper queries the fresh pool's
connection. The stub never takes effect, the index dump lacks the
tablespace, and the example fails under randomized ordering.
Stub @conn.use_foreign_keys? on the live connection instead. That keeps
the pool intact, avoids cross-describe state leakage, and still
exercises every oracle-enhanced gate (add_foreign_key early return,
SchemaCreation FK skip, SchemaDumper FK skip). The
foreign_keys: false → use_foreign_keys? == false plumbing is Rails
core's responsibility (foreign_keys_enabled? = @config.fetch(...))
and is already covered upstream.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 26d4cc2 commit 6583bca
1 file changed
Lines changed: 10 additions & 15 deletions
Lines changed: 10 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
440 | 440 | | |
441 | 441 | | |
442 | 442 | | |
443 | | - | |
444 | | - | |
445 | | - | |
| 443 | + | |
446 | 444 | | |
447 | | - | |
448 | 445 | | |
449 | 446 | | |
450 | 447 | | |
| |||
460 | 457 | | |
461 | 458 | | |
462 | 459 | | |
| 460 | + | |
463 | 461 | | |
464 | 462 | | |
465 | 463 | | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | 464 | | |
474 | 465 | | |
475 | 466 | | |
476 | 467 | | |
477 | 468 | | |
478 | 469 | | |
| 470 | + | |
479 | 471 | | |
480 | 472 | | |
481 | 473 | | |
482 | 474 | | |
| 475 | + | |
483 | 476 | | |
484 | 477 | | |
485 | 478 | | |
486 | 479 | | |
487 | 480 | | |
488 | | - | |
| 481 | + | |
489 | 482 | | |
490 | 483 | | |
491 | | - | |
| 484 | + | |
| 485 | + | |
492 | 486 | | |
493 | 487 | | |
494 | 488 | | |
495 | 489 | | |
496 | 490 | | |
497 | | - | |
| 491 | + | |
498 | 492 | | |
499 | 493 | | |
500 | 494 | | |
| 495 | + | |
501 | 496 | | |
502 | 497 | | |
503 | 498 | | |
504 | 499 | | |
505 | 500 | | |
506 | 501 | | |
507 | 502 | | |
508 | | - | |
| 503 | + | |
509 | 504 | | |
510 | 505 | | |
511 | 506 | | |
| |||
0 commit comments