diff options
author | Arthur Neves <arthurnn@gmail.com> | 2015-02-18 10:17:31 -0500 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-03-18 09:52:19 +0100 |
commit | 8017e6af31caa58a58787274ff0ca01397219e49 (patch) | |
tree | 4da2b6124b7128c052b787b77b000ac50106bd16 /railties/lib/rails/test_unit | |
parent | f10c7e184939064be9e4995551efc3ebc3a8b883 (diff) | |
download | rails-8017e6af31caa58a58787274ff0ca01397219e49.tar.gz rails-8017e6af31caa58a58787274ff0ca01397219e49.tar.bz2 rails-8017e6af31caa58a58787274ff0ca01397219e49.zip |
Use Rails::TestRunner on rake test
Diffstat (limited to 'railties/lib/rails/test_unit')
-rw-r--r-- | railties/lib/rails/test_unit/testing.rake | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake index d836c0d6d6..f3a43a12db 100644 --- a/railties/lib/rails/test_unit/testing.rake +++ b/railties/lib/rails/test_unit/testing.rake @@ -1,11 +1,12 @@ -require 'rake/testtask' -require 'rails/test_unit/sub_test_task' +require "rails/test_unit/runner" task default: :test desc "Runs all tests in test folder" task :test do - Rails::TestTask.test_creator(Rake.application.top_level_tasks).invoke_rake_task + $: << "test" + ARGV.shift if ARGV[0] == "test" + Rails::TestRunner.run(ARGV) end namespace :test do @@ -14,30 +15,30 @@ namespace :test do # If used with Active Record, this task runs before the database schema is synchronized. end - Rails::TestTask.new(:run) do |t| - t.pattern = "test/**/*_test.rb" - end + task :run => %w[test] desc "Run tests quickly, but also reset db" task :db => %w[db:test:prepare test] - Rails::TestTask.new(single: "test:prepare") - ["models", "helpers", "controllers", "mailers", "integration", "jobs"].each do |name| - Rails::TestTask.new(name => "test:prepare") do |t| - t.pattern = "test/#{name}/**/*_test.rb" + task name => "test:prepare" do + $: << "test" + Rails::TestRunner.run(["test/#{name}"]) end end - Rails::TestTask.new(generators: "test:prepare") do |t| - t.pattern = "test/lib/generators/**/*_test.rb" + task :generators => "test:prepare" do + $: << "test" + Rails::TestRunner.run(["test/lib/generators"]) end - Rails::TestTask.new(units: "test:prepare") do |t| - t.pattern = 'test/{models,helpers,unit}/**/*_test.rb' + task :units => "test:prepare" do + $: << "test" + Rails::TestRunner.run(["test/models", "test/helpers", "test/unit"]) end - Rails::TestTask.new(functionals: "test:prepare") do |t| - t.pattern = 'test/{controllers,mailers,functional}/**/*_test.rb' + task :functionals => "test:prepare" do + $: << "test" + Rails::TestRunner.run(["test/controllers", "test/mailers", "test/functional"]) end end |