Minitest - Run all tests from the directory
I’ve tried to use Minitest for small ruby projects/exercises. Before that, I was always using rspec
. But now I have some time and I wanted to try something new. Old “new”, hehe 😅. Minitest is straight forward, fast, what’s not to like. And it comes with Ruby by default since 1.9.
Anyway, to my big surprise I couldn’t run all the tests from the directory, and playing one by one is time-consuming and tedious. If there is a default way how to run them all, please share, meanwhile here comes little Rakefile:
require 'rake/testtask'
desc 'Run specs'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = './*_spec.rb'
t.verbose = true
end
Now just run rake test
and enjoy TDD.