Add SimpleCov and expand test coverage - #19
Open
benrfairless wants to merge 1 commit into
Open
Conversation
This was referenced Aug 12, 2026
benrfairless
marked this pull request as ready for review
August 12, 2026 01:56
benrfairless
force-pushed
the
chore/increase-test-coverage
branch
from
August 12, 2026 03:00
1af7e36 to
c0d19a1
Compare
ianheggie-oaf
approved these changes
Aug 12, 2026
ianheggie-oaf
left a comment
Member
There was a problem hiding this comment.
Approved - LGTM at a glance
benrfairless
force-pushed
the
chore/increase-test-coverage
branch
from
August 12, 2026 03:51
c0d19a1 to
d8e22a4
Compare
Adds meaningful coverage for the parts of the gem that previously had none: the HTTP interaction with the Morph server and the Thor command line interface. - Add SimpleCov with branch coverage and a 90% minimum; the suite currently measures 97.5% line / 95.8% branch coverage - Add WebMock and disable all network access in specs - Extract the Thor CLI class from bin/morph into MorphCLI::CLI in lib/morph-cli/cli.rb so it is loadable (and therefore testable); bin/morph is now a thin wrapper with unchanged behaviour - Spec MorphCLI.execute against stubbed HTTP: streams run output, posts the API key and code as multipart form data, raises on 401, exits when no scraper file is present - Spec the CLI: version command, --dev config selection, API key prompting/saving, retry on rejected key, and exit paths for connection, server and client errors - Spec log stream routing, config save/load round-trip and permissions, tar creation/read-back, directory sizing and in_directory restoration - Exclude spec files from Metrics/BlockLength (standard practice) 29 examples, 0 failures on Ruby 3.4.10; RuboCop clean. Assisted-by: opencode/anthropic.claude-fable-5 Signed-off-by: Ben Fairless <ben@oaf.org.au>
benrfairless
force-pushed
the
chore/increase-test-coverage
branch
from
August 13, 2026 06:03
d8e22a4 to
87ae319
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.
Description
Adds real test coverage to the gem, which previously only had smoke tests for two pure helper methods:
bin/morphintoMorphCLI::CLI(lib/morph-cli/cli.rb) so it can be loaded and tested;bin/morphbecomes a thin wrapper with identical behaviourMorphCLI.execute(streaming run output, multipart upload of API key + code, 401 handling, missing-scraper exit), the CLI (version,--devconfig selection, API key prompt/save/retry, connection/server/client error exits), log stream routing, config save/load round-trip and 0600 permissions, tar creation and read-back, directory sizing, andin_directoryrestorationMetrics/BlockLength(standard RuboCop practice)Motivation and Context
The CLI commands and all API interaction were completely untested, which makes upgrades like #18 risky. This locks in behaviour before further changes, without hitting the network in tests.
How Has This Been Tested?
On Ruby 3.2.2:
bundle exec rspec— 29 examples, 0 failures;bundle exec rubocop— no offenses; manual smoke test ofbin/morph version.Screenshots (if appropriate):
N/A
Types of Changes
Test/refactor only; no behaviour change to the shipped CLI.
Checklist:
Part 3 of the 5-PR modernisation series. Stacked on #18 (base branch
chore/upgrade-ruby); GitHub will retarget as the stack merges.Assisted-by: opencode/anthropic.claude-fable-5