Skip to content

fix(ruby): use rails test for positional file args in rtk rake#741

Merged
aeppling merged 1 commit intortk-ai:developfrom
Maimer:pim_fix_rake_multiple_test_files
Mar 20, 2026
Merged

fix(ruby): use rails test for positional file args in rtk rake#741
aeppling merged 1 commit intortk-ai:developfrom
Maimer:pim_fix_rake_multiple_test_files

Conversation

@Maimer
Copy link

@Maimer Maimer commented Mar 19, 2026

RubyRails

Summary

  • rake test ignores positional file arguments (e.g., rtk rake test file1.rb file2.rb) and only supports single-file targeting via TEST=path — this caused "no tests ran" or all tests running when users passed multiple files
  • Added select_runner() that auto-switches to rails test when positional test file paths are detected, since rails test natively handles single files, multiple files, and line-number syntax (file.rb:15)
  • rake test is still used for TEST=path, flags-only, and no-args invocations (existing behavior preserved)

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test — 1044 tests pass
  • Manual testing: rtk <command> output inspected
    • rtk rake test → rake, 57 runs (all tests)
    • rtk rake test TEST=file.rb → rake, 1 run
    • rtk rake test file.rb → rails, 2 runs (just that file)
    • rtk rake test file1.rb file2.rb → rails, 3 runs (both files)
    • rtk rake test file.rb:10 → rails, 1 run (specific line)
  • 8 new unit tests for select_runner() and looks_like_test_path()
  • CHANGELOG.md updated

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

rake test ignores positional file arguments and only supports TEST=path
for single-file runs. When users pass positional test files (e.g.,
`rtk rake test file1.rb file2.rb` or `rtk rake test file.rb:15`),
select_runner() now switches to `rails test` which handles single files,
multiple files, and line-number syntax natively.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Nicholas Lee <nicholas.lee@appfolio.com>
@Maimer
Copy link
Author

Maimer commented Mar 19, 2026

@pszymkowiak this fixes a small issue with #724 that was merged earlier today.

@aeppling aeppling self-assigned this Mar 20, 2026
@aeppling
Copy link
Contributor

Hello,

Thanks for this clean contribution,

OK for me, code is explicit and tested

@aeppling aeppling merged commit ec92c43 into rtk-ai:develop Mar 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants