Trying to use a rake task to run only tests in the test/models directory. Using minitest.
I have a rake task that will run all test
require "rake/testtask"
Rake::TestTask.new(:test => "db:test:prepare") do |t|
t.libs << "test"
t.pattern = "test/**/*_test.rb"
end
task :default => :test
Then, running 'rake' hits the default and runs all tests. I want to write a second rake task that would only run tests in the models directory (test/models/).
I played around with this existing TestTask by simply changing
t.pattern = "test/**/*_test.rb"
to
t.pattern = "test/models/*_test.rb"
but, it seems to still run all the tests...not just models. Strange?
QUESTIONS
How can I accomplish this? How to I need to name a second TestTask that will run only models, and how do I tell rake to run that test instead of the default :test?