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
yuuji.yaginuma df744b56cc modify to pass the correct argument to the test runner from rake
test runner sets file to be tested in plugin_rails_options,
but in plugin_rails_options, processing has been made to the argument of the
actual command rather than the argument of Minitest.run.

For example, if you run `./bin rake db:migrate test`, the options[:patterns], `db:migrate test` was incorrectly set.
2015-09-08 08:07:29 +09:00

45 lines
1.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.rake_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.rake_run(["test/#{name}"])
end
end
task :generators => "test:prepare" do
$: << "test"
Minitest.rake_run(["test/lib/generators"])
end
task :units => "test:prepare" do
$: << "test"
Minitest.rake_run(["test/models", "test/helpers", "test/unit"])
end
task :functionals => "test:prepare" do
$: << "test"
Minitest.rake_run(["test/controllers", "test/mailers", "test/functional"])
end
end