Add test coverage for IsolatedExecutionState#key?, #delete, and #context#57032
Merged
Merged
Conversation
These public methods on IsolatedExecutionState had no dedicated test coverage.
9774e91 to
649c762
Compare
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.
Motivation / Background
ActiveSupport::IsolatedExecutionStatehas tests for#[],#[]=, isolation level switching, and#share_with, but the#key?,#delete, and#contextpublic methods have no dedicated test coverage.Detail
This Pull Request adds 7 tests to
activesupport/test/isolated_execution_state_test.rb:#key?returns true for existing key — sets a key, verifieskey?returns true#key?returns false for non-existing key — verifieskey?returns false for missing key#key?handles nil state gracefully — clears state, verifies no error when state is uninitialized#deleteremoves key and returns its value — sets a key, deletes it, verifies return value and absence#deletereturns nil for non-existing key — deletes a missing key, asserts nil#contextreturns current thread — under:threadisolation, verifiescontext == Thread.current#contextreturns current fiber — under:fiberisolation, verifiescontext == Fiber.currentAdditional information
All 13 tests in
isolated_execution_state_test.rbpass with 0 failures, 27 assertions.Checklist