1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/lib/rails/test_unit/testing.rake
Kasper Timm Hansen b6fc8e25a1 Improve test runner's Minitest integration.
This also adds free mix and matching of directories, files and lines filters.
Like so:

bin/rails test models/post_test.rb test/integration models/person_test.rb:26

You can also mix in a traditional Minitest filter:

bin/rails test test/integration -n /check_it_out/
2015-06-04 20:57:08 +02:00

45 lines
1 KiB
Ruby

gem 'minitest'
require 'minitest'
require 'rails/test_unit/minitest_plugin'
task default: :test
desc "Runs all tests in test folder"
task :test do
$: << "test"
Minitest.run(['test'])
end
namespace :test do
task :prepare do
# Placeholder task for other Railtie and plugins to enhance.
# If used with Active Record, this task runs before the database schema is synchronized.
end
task :run => %w[test]
desc "Run tests quickly, but also reset db"
task :db => %w[db:test:prepare test]
["models", "helpers", "controllers", "mailers", "integration", "jobs"].each do |name|
task name => "test:prepare" do
$: << "test"
Minitest.run(["test/#{name}"])
end
end
task :generators => "test:prepare" do
$: << "test"
Minitest.run(["test/lib/generators"])
end
task :units => "test:prepare" do
$: << "test"
Minitest.run(["test/models", "test/helpers", "test/unit"])
end
task :functionals => "test:prepare" do
$: << "test"
Minitest.run(["test/controllers", "test/mailers", "test/functional"])
end
end