blob: 254ea9ecf6bc0c7059d744528bb5804747a47352 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
require 'rake/testtask'
require 'rails/test_unit/sub_test_task'
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
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
Rails::TestTask.new(:run) do |t|
t.pattern = "test/**/*_test.rb"
end
desc "Run tests quickly, but also reset db"
task :db => %w[db:test:prepare test]
desc "Run tests quickly by merging all types and not resetting db"
Rails::TestTask.new(:all) do |t|
t.pattern = "test/**/*_test.rb"
end
Rake::Task["test:all"].enhance do
Rake::Task["test:deprecate_all"].invoke
end
task :deprecate_all do
ActiveSupport::Deprecation.warn "rake test:all is deprecated and will be removed in Rails 5. " \
"Use rake test to run all tests in test directory."
end
namespace :all do
desc "Run tests quickly, but also reset db"
task :db => %w[db:test:prepare test:all]
Rake::Task["test:all:db"].enhance do
Rake::Task["test:deprecate_all"].invoke
end
end
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"
end
end
Rails::TestTask.new(generators: "test:prepare") do |t|
t.pattern = "test/lib/generators/**/*_test.rb"
end
Rails::TestTask.new(units: "test:prepare") do |t|
t.pattern = 'test/{models,helpers,unit}/**/*_test.rb'
end
Rails::TestTask.new(functionals: "test:prepare") do |t|
t.pattern = 'test/{controllers,mailers,functional}/**/*_test.rb'
end
end
|