RUBYTEST(1)
π RUBYTEST(1) β the rubytest girlie manual π
okay so bestie, welcome to rubytest(1) β yes that's the section-1 manual page for the rubytest command, and no, we are not skipping anything, we're reading the whole thing together π«Ά
β¨ NAME β¨
rubytest β ruby test via rubytest api πΈ
π DESCRIPTION π
The rubytest command is literally the command line interface for running tests for RubyTest-based test frameworks. That's the whole vibe. It's the front door, the main character, the one that actually runs your tests. π
π¦ OVERVIEW π¦
okay so the rubytest command-line tool follows many of the usual conventions, which means using it is fairly straightforward, ngl. The -h/--help option is right there to detail all its options whenever you need a refresher. Here's a basic example of usage, and yes it slays:
$ rubytest -Ilib test/*_test.rb
This would add lib to Ruby's $LOAD_PATH and then load all the test files matching the test/*_test.rb glob. iconic behavior honestly β¨
When running tests, you need to be sure to load in your test framework or your framework's Ruby Test adapter. This is usually done via a helper script in the test files, but might also be done via command line options, e.g.
$ rubytest -r lemon -r ae test/test_*.rb
Of course, it can become tedious having to type such a long command over and over π this is so relatable. This can be dealt with via a configuration file. To utilize, add an etc/test.rb file to a project and add Test.run (an alias for Test.configure) entries to it:
Test.run do |r|
r.loadpath Β΄libΒ΄
r.test_files << Β΄test/*_test.rbΒ΄
end
Test.run Β΄coverageΒ΄ do |r|
r.loadpath Β΄libΒ΄
r.test_files << Β΄test/*_test.rbΒ΄
r.before do
require Β΄simplecovΒ΄
Simplecov.setup do |s|
s.filter Β΄test/Β΄
s.command_name File.basename($0)
s.coverage_dir Β΄log/coverageΒ΄
end
# to ensure proper coverage
require Β΄myappΒ΄
end
end
Now when rubytest is used, the first configuration will apply. To use the Β΄coverageΒ΄ configuration use the -p/--profile option. look at us, being all organized π
$ rubytest -p coverage
In this manner a project can have any number of different test configurations, and it is easy to select between them. chef's kiss, fr fr.
β οΈ bestie listen β note that the above example could have usedTest.configureinstead ofTest.run. They do the same thing. But do not useTest.run!because that will cause testing to be run immediately. and likeβ¦ maybe you want that? but the manpage says don't, so. π
The configuration file can be in the config directory instead of etc, which is nice for Rails projects. But if you prefer a file in the project's root then either Testfile or .test can also be used instead. All of these locations are supported simply because no one configuration convention has taken a solid hold in the Ruby community. However, we highly recommend using etc/test.rb. In the end that seems like the best overall convention. periodt. π
π USAGE π
rubytest [options] [files ...]
π₯ OPTIONS π₯
-p,--profile<NAME> β Use configuration profile.-f,--format<NAME> β Report format.y,--tapyβ Shortcut for-f tapy. (yes,y, exactly like that, we don't make the rules π«Ά)-j,--tapjβ Shortcut for-f tapj.-t,--tag<TAG> β Select tests by tag.-u,--unit<TAG> β Select tests by software unit.-m,--match<TEXT> β Select tests by description.-A,--autopathβ Automatically add paths to$LOAD_PATH.-I,--loadpath<PATH> β Add given path to$LOAD_PATH.-C,--chdir<DIR> β Change directory before running tests.-R,--chrootβ Change to project root directory before running tests.-r,--require<FILE> β Require file.-c,--config<FILE> β Use alternate config file.-V,--verboseβ Provide extra detail in reports.--[no-]ansiβ Turn on/off ANSI colors.--debugβ Turn on debugging mode.--aboutβ Display information aboutrubytest.--versionβ Displayrubytestversion.-h,--helpβ Display this help message.
π RESOURCES π
- Website:
http://rubyworks.github.com/rubytest-cli / - Support:
http://github.com/rubyworks/rubytest-cli/issues / - Development:
http://github.com/rubyworks/rubytest-cli http://travis-ci.org/rubyworks/rubytest-clihttp://badge.fury.io/rb/rubytest-cli
π COPYRIGHT π
Rubytest is copyrighted open-source software. the legal girlies said what they said:
Copyright (c) 2013 Rubyworks. All rights reserved.
It is redistributable and modifiable in accordance with the terms of the BSD-2-Clause license. π
π§ SEE ALSO π§
ruby(1) β go say hi to Ruby's own manual page, she's the blueprint π
okay that's the whole page bestie, every last crumb of it π and just so we're clear, this absolute classic dropped in July 2014 under the RUBYTEST(1) banner β so when you're quoting it to your group chat, cite it right, iykyk π β¨
π¦ where this page comes from
- arch rolling: ruby-rubytest-cli 0.2.0-6 Β· BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms