test: cover character builders, roll check helper and http client - #114
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
test: cover character builders, roll check helper and http client#114devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
The app/builders tree had no specs of its own; coverage came only incidentally from create-character command specs, leaving the dispatchers' DummyBuilder fallbacks and most concrete builders unexercised. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
app/builderswas the largest app directory with no specs of its own — its coverage came incidentally from create-character command specs, so the dispatcher fallbacks and most concrete builders were unexercised (dnd2024_character/background_builder.rbandtlc_character/background_builder.rbsat at 54.5%). This adds specs for the builder layer plus the two other lowest-covered app files,app/helpers/roll_check_helper.rb(33.3%) andapp/lib/http_service/client.rb(42.1%). No production code changed.Coverage: 94.49% → 95.29%, examples 793 → 1376. All targeted files are now 100% except
http_service/client.rb, whose remaining gap isbuild_connection(never used in tests by design).Three layers of builder specs:
BaseBuilder specs pin the initial sheet each provider produces — notably the differences that are easy to break: TLC starts at
START_LEVEL = 3and seedsclasses/hit_dicewith 3 while dnd2024/dnd5 start at 1, dnd2024/TLC use a Hash forselected_skillswhile dnd5 uses an Array, and only dnd2024/TLC setguide_step.Dispatcher specs (class/species/background/legacies/race/subrace) cover both the constantize path and the
rescue NameError => DummyBuilderfallback, which is what the low coverage was hiding. The success paths loop over the config rather than a hardcoded list, so a newly configured class/background/race is asserted automatically:The TLC class spec derives which slugs have no TLC builder instead of hardcoding them, so adding one flips the expectation from "abilities stay unset" to the full assertion rather than leaving a stale skip behind.
spec/builders/builder_contract_spec.rbsweeps all ~110 concrete builders (globbed off disk, minus the DB-backedCustomBuilders) against invariants the create commands rely on: the builder returns the sheet it was handed, the collections it appends to are duplicate-free and idempotent (a missing.uniqsurfaces on a sheet as a doubled proficiency), andhealth/abilitiesare well formed when assigned.HttpService::Clientis exercised over Faraday's test adapter, asserting the request shape each verb builds (JSON body vs.URI.encode_www_form, params/headers pass-through), the success/nil/{ success: false }return contracts, and that the'please stub request in test env'guard fires for every verb when no test adapter is wired.Pre-existing failures on
mainare unaffected and unrelated: twojavascript_include_tag 'application'asset-pipeline failures andspec/javascript_spec.rb(nospec/javascript/*.test.jsin this branch).Link to Devin session: https://app.devin.ai/sessions/e58270d7a3354edcba46a1c4146a6d2b
Requested by: @zacgoodwin