
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Often I want to run just one test in a class full of other tests. I usually end up just commenting out everything except for the one test I want to run, but that's kind of lame, so I decided to write a Rake test that lets me do this instead:
$ rake test:this["models/the_model","this is the test"]
This works for both Rails and Minitest.
Add this line to your application's Gemfile:
gem 'test-this'
And then execute:
$ bundle
Or install it yourself as:
$ gem install test-this
After you install the gem, add this to your Rakefile to use it:
require 'test/this'
Test::This.configure do |config|
config.file_suffix = '_test.rb'
config.test_method_prefix = 'test_'
config.test_path = File.expand_path('../test', __FILE__)
end
To run a single test from a class full of other tests you don't want to run:
$ rake test:this["controllers/this_controller","the name of the test"]
To test all of the tests in a class full of tests you want to run:
$ rake test:this["controllers/this_controller"]
Note that you can leave off the trailing _test.rb
in the name of the test and
the prefixed test_
in the name of the test methods for Minitest. For example,
if your Minitest case looked like this:
# file: test/something_test.rb
class SomethingTest < Minitest::Test
def test_the_test_to_run
assert true
end
def test_not_the_test_to_run
fail
end
end
To run the test_the_test_to_run
:
$ rake test:this["something","the test to run"]
Spaces will automatically be converted to underscores.
Bug reports and pull requests are welcome on GitHub at hi5dev/test-this.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that test-this demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.