根据 ryan bates railscast ( http://railscasts.com/episodes/327-minitest-with-rails ),我创建了一个 minitest.rake。
当我在终端中运行 rake 时,测试会运行,然后在重置命令行之前再次运行。
require "rake/testtask"
Rake::TestTask.new(:test => "db:test:prepare") do |t|
t.libs << "test"
t.pattern = "test/**/*_test.rb"
end
task default: :test