Repository navigation
test: close strong_migrations preboot note coverage gaps - #3062
Merged
Merged
Conversation
Follow-up to #3057's review, which found the spec too narrow for the invariants it claims: - the "other checks unchanged" example sampled only :add_index; it now asserts the note's absence on every key outside the preboot list - the "exactly once" example now also asserts the note is never the message prefix, which with the single-occurrence count proves the gem text comes first for all nine keys without hardcoding nine default wordings - no test covered the loud-failure design: an example reloads the initializer with :rename_column removed from error_messages and expects KeyError, so a future gem dropping a listed key cannot fail silently Mutation-checked: appending the note to every key fails the untouched-keys example, and dropping the append fails the ordering and KeyError ones.
Review of this PR found the exactly-once example could go green while the note came first: count == 1 plus not-start-with only rules out a literal 'Heroku preboot' prefix, so any other prefix before the note passes. Assert each message ends with the note; note-last plus the count pins gem-text-first for all nine keys. Also retitle the untouched-keys example to claim only what it asserts (no preboot note added), and capture the stub value before the allow call so the capture-before-stub order reads literally instead of depending on argument evaluation order (two reviewers mis-read it).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #3057's review, which found the new spec narrower than the invariants it claims. This PR widens the spec to match; no production code changes.
:add_index.:rename_columnremoved fromerror_messagesand expectsKeyError, covering the loud-failure design for a future gem version that drops a listed key.Review notes
Small test-only diff, a skim is enough. The one pattern worth a look is the reload of
config/initializers/strong_migrations.rbinside the spec: the value for the stub is captured before the stub installs, and the initializer re-runs harmlessly otherwise. Scope stays as #3057 decided:add_column_defaultand the other AGENTS.md-listed hazards are deliberately not on the note list.