Explain the two load-bearing lines in the binary snapshot spec - #15
Merged
Merged
Conversation
Two things in this spec look removable and are not. Text-mode IO#write only transcodes — and so only raises — when an internal encoding is set, which is why the bug surfaced in a Rails app (config.encoding sets one) and never in this suite; drop the assignment and the spec passes against the bug. And the fake adapter's connection argument feeds Store#initialize, which builds its Fingerprint from adapter.instance_variable_get(:@connection); removing it as dead fails the suite.
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.
Why
Follow-up to #13. Both fixes landed correctly, but two explanatory comments were left behind when that branch merged.
Two lines in the binary round-trip spec read as removable and are not. I know because I removed one of them during review and broke the suite:
Encoding.default_internal = Encoding::UTF_8— text-modeIO#writeonly transcodes, and so only raises, when an internal encoding is set. Rails sets one fromconfig.encoding, which is why the bug surfaced in an app and never in this SQLite-only suite. Drop the assignment and the spec passes against the bug it exists to catch.BinaryDataAdapter#initialize'sconnectionargument — it is never read inside the fake, so it looks dead.Store#initializebuilds its Fingerprint fromadapter.instance_variable_get(:@connection).Summary
bundle exec rake: 216 examples, 0 failures, standard clean.