test: add unit tests and wire up cookstyle autocorrect#1
Merged
Conversation
- Add RSpec test suite (.rspec, spec/spec_helper.rb) with 20 specs:
- spec/kitchen-sync/version_spec.rb: validate VERSION constant
- spec/kitchen-sync/checksums_spec.rb: invoke bundled checksums.rb
against tmpdirs and validate JSON output
- spec/kitchen-sync/core_ext_spec.rb: cover the ChefBase#init_command
monkey-patch using a stub ChefBase (test-kitchen 4 no longer ships it)
- spec/kitchen/transport/{rsync,sftp}_spec.rb: validate transport class
structure, defaults, and constants
- Add `rspec ~> 3.0` development dependency
- Add rake `spec` task plus `test`/`unit` aliases (with desc so they show
up in `rake -T`); default task now runs `spec` then `style`
- Add unit test job to .github/workflows/lint.yml gated on cookstyle/yamllint
- Apply cookstyle/chefstyle autocorrect across lib/ and gemspec:
- Switch single-quoted strings to double-quoted
- Replace deprecated File.exists? with File.exist?
- Replace `"..." % args` with format(...)
- Add `unless defined?(...)` guards to stdlib requires
- Fix indentation, guard-clause spacing, and end alignment
- Freeze mutable string constants
- Use `each_with_object` instead of `inject` returning memo
- Use $CHILD_STATUS / $INPUT_RECORD_SEPARATOR via English
- Update copyright header format and bump rubygems source to https
- Drop dead `File.directory?(local)` no-op left by autocorrect in sftp.rb
Signed-off-by: Lance Albertson <lance@osuosl.org>
Signed-off-by: Lance Albertson <lance@osuosl.org>
6e59731 to
73c514a
Compare
Stromweld
approved these changes
Apr 24, 2026
Stromweld
left a comment
There was a problem hiding this comment.
LGTM, not sure what the require "English" is for in a couple of places. Never seen that one before.
Collaborator
Author
|
Good question. This require is needed because this file logs the rsync exit code using Upstream Ruby docs:
If we wanted to drop require "English", we would need to switch this code to |
|
nice good to know thanks |
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.
against tmpdirs and validate JSON output
monkey-patch using a stub ChefBase (test-kitchen 4 no longer ships it)
structure, defaults, and constants
rspec ~> 3.0development dependencyspectask plustest/unitaliases (with desc so they showup in
rake -T); default task now runsspecthenstyle"..." % argswith format(...)unless defined?(...)guards to stdlib requireseach_with_objectinstead ofinjectreturning memoFile.directory?(local)no-op left by autocorrect in sftp.rbSigned-off-by: Lance Albertson lance@osuosl.org
Description
Please describe what this change achieves
Issues Resolved
List any existing issues this PR resolves, or any Discourse or
StackOverflow discussions that are relevant
Type of Change
Our release process assumes you are using Conventional Commit messages.
The most important prefixes you should have in mind are:
_fix_: which represents bug fixes, and correlates to a SemVer patch._feat_: which represents a new feature, and correlates to a SemVer minor._feat!_:, orfix!:,refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a major version change.If you have not included a conventional commit message this can be fixed on merge.
Check List